置顶 后台执行两条SQL语句
置顶 后台执行两条SQL语句 private void toTop( int pEC_TempID) { int mEC_TempID = 0; object oEC_TempID = myShare.GetAObject( true , 0, "EC_TempID" , "ElectronCards_temp" , "VendorID=" + ViewState[ "VendorID" ].ToString() + " and WebSiteType=
置顶 后台执行两条SQL语句
private void toTop(int pEC_TempID) { int mEC_TempID = 0; object oEC_TempID = myShare.GetAObject(true, 0, "EC_TempID", "ElectronCards_temp", "VendorID=" + ViewState["VendorID"].ToString() + " and WebSiteType=" + ViewState["WebSiteTypeID"].ToString()); if (oEC_TempID != null) { mEC_TempID = int.Parse(oEC_TempID.ToString()); } SqlConnection con = null; bool flag = false; try { con = new SqlConnection(ConfigurationManager.AppSettings["ConnectionString"]); string sql1 = "update ElecProducts_Temp set DisplayOrder = case when DisplayOrder=255 then DisplayOrder else DisplayOrder+1 end where EC_TempID = "+mEC_TempID; string sql2 = "update ElecProducts_Temp set DisplayOrder=1 where EP_TempID=" + pEC_TempID; con.Open(); SqlCommand com = new SqlCommand(sql1, con); flag = com.ExecuteNonQuery() > 0 ? true : false; SqlCommand com2 = new SqlCommand(sql2, con); flag = com2.ExecuteNonQuery() > 0 ? true : false; con.Close(); } catch (SqlException se) { } finally { con.Close(); } if (flag) { myShare.WebMessageBox(this.Page, "置顶成功!"); int mECP_TempID = Convert.ToInt32(myShare.GetAObject(true, 0, "EC_TempID", "ElectronCards_temp", "VendorID=" + ViewState["VendorID"].ToString() + " and WebSiteType=" + ViewState["WebSiteTypeID"].ToString())); BindToDataList(mECP_TempID); } else { myShare.WebMessageBox(this.Page, "置顶信息时出错,请重试!"); } }
posted on
Copyright ©2013 porray Powered By: 博客园 模板提供:沪江博客
,推荐阅读
-
ThinkPHP框架获取最后一次执行SQL语句及变量调试简单操作示例
-
Laravel框架执行原生SQL语句及使用paginate分页的方法
-
php与mysql建立连接并执行SQL语句的代码
-
Mybaits 源码解析 (六)----- 全网最详细:Select 语句的执行过程分析(上篇)(Mapper方法是如何调用到XML中的SQL的?)
-
Yii框架在页面输出执行sql语句以方便调试的实现方法
-
从零开始学习SQL查询语句执行顺序
-
thinkPHP框架中执行原生SQL语句的方法
-
Yii框架调试心得--在页面输出执行sql语句
-
SQL语句执行过程、原理详解
-
oracle导出sql语句的结果集和保存执行的sql语句(深入分析)