在做域用户同步时,需要用到事务,如执行未成功或者。执行回滚操作(事务如无必要,尽量少用),具体代码如下:
// using (SqlConnection conn = new SqlConnection(SqlHelper.DB_CONNECTION_STRING)) // { // //定义命令 // SqlCommand cmd = new SqlCommand(); // //设置链接 // cmd.Connection = conn; // //打开链接 // conn.Open(); // //产生事务 // SqlTransaction tran = conn.BeginTransaction(); // //设置事务处理对象 // cmd.Transaction = tran; // try // { // 处理业务 // //提交 // tran.Commit(); // } // catch (Exception ex) // { // //回滚 // tran.Rollback(); // throw ex; // } // }
在sharepoint 中数据控件的添加 同 vs 一样需要注册(需要注意的有 显示数据必须关联数据源控件) 代码如 <%@ Register Tagprefix="WebPartPages" Namespace="Microsoft.SharePoint.WebPartPages" Assembly="Microsoft.SharePoint, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
需要注意。其中静态页面的样式,或者会和shqrepoint 中自带的样式冲突
界面添加 js 动态时间: 代码如下
(注意 在 onLoad 中调用 js 方法 )
<script type="text/javascript" language="javascript"> var isnDay = new Array("星期日", "星期一", "星期二", "星期三", "星期四", "星期五", "星期六", "星期日"); function ShowTime() { var dt = new Date(); var temp = dt.getYear() + "年" + (dt.getMonth() + 1) + "月" + dt.getDate() + "日 " + isnDay[dt.getDay()]; temp += " " + dt.getHours() + ": "; if (dt.getMinutes() < 10) { temp += "0"; } temp += dt.getMinutes() + ": "; if (dt.getSeconds() < 10) { temp += "0"; } temp += dt.getSeconds() + "&nbsp;"; document.getElementById("TimeSpan").innerHTML = temp; window.setTimeout("ShowTime()", 1000) } function winOnLoad() { ShowTime(); window.setTimeout("ShowTime()", 1000) } </script>
本站技术原创栏目文章均为中睿原创或编译,转载请注明:文章来自中睿,本站保留追究责任的权利。