Stick to the background and execute two SQL statements

Source: Internet
Author: User
Execute two SQL statements privatevoidtoTop (intpEC_TempID) {intmEC_TempID0; reset (true, 0, EC_TempID, ElectronCards_temp, VendorVendorID]. ToString () + andWebSiteType

Set the top backend to execute two SQL statements: 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 =

Stick to the background and execute two SQL statements

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 wh Ere 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, "topped successfully! "); 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, "An error occurred while setting the top information. Please try again! ");}}

Posted on

Copyright©2013 porray Powered By: blog Park template: Hujiang blog

,

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.