置顶 后台执行两条SQL语句

WBOY
發布: 2016-06-07 17:39:16
原創
844 人瀏覽過

置顶 后台执行两条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: 博客园 模板提供:沪江博客

相關標籤:
來源:php.cn
本網站聲明
本文內容由網友自願投稿,版權歸原作者所有。本站不承擔相應的法律責任。如發現涉嫌抄襲或侵權的內容,請聯絡admin@php.cn
最新問題
熱門教學
更多>
最新下載
更多>
網站特效
網站源碼
網站素材
前端模板