C # determine whether the values in a column field in the database table exist

Source: Internet
Author: User
1           //  Modify website file module  2           Public   Int Upstatewebproductscontentconfig ( Long Itestid, Int  Iseq)// Itestid is the ID of the website file, and iseq is the field value to be modified  3   {  4               If (_ Iloginret! = 0 )Return - 1  ;  5   6 STC. model. showwebproductscontentconfig mshowwebproductscontentconfig = New  Model. showwebproductscontentconfig ();  7 Duser. stablename = Mshowwebproductscontentconfig. stablename;  8               String Strsql = "  Iseq = " + Iseq. tostring () + "   "  ;// As a condition for Searching databases  9               Int Flag = Duser. getcount (strsql );// Use the getcount common function to search for the iseq field = number of values in the database. If there are multiple iseq fields, you cannot set them again.  10               If (Flag> 0  )// If flag = 0,-4 is returned, and Ajax prompts an error at the front-end  11                   Return - 4  ;  12   Duser. GetModel (mshowwebproductscontentconfig, itestid );//GetModel is a parent function and a public method. When it is modified, the values of other fields are not affected.  13               If (Mshowwebproductscontentconfig = Null ) Return - 3  ;  14   15 Mshowwebproductscontentconfig. iseq =Iseq;// If there are no duplicatesModify the value of this field  16   Duser. Update (mshowwebproductscontentconfig );// This is a parent function for modification.  17   18               Return   0  ;  19 }

 

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.