Use layer three to determine if the code in the SQL database already exists (personal my book, do not want to spray)

Source: Internet
Author: User

Myself. NET Novice, the beginner three layer will want to record to write notes, for like oneself the new person to study, the great God does not have to see

DAL layer:

Determine if the encoding exists
</summary>
<param name= "Strhydrologyno" ></param>
<param name= "Strid" ></param>
<returns></returns>
public bool Exit (string strdrainno,string strid)
{
StringBuilder strSQL = new StringBuilder ();
{
Strsql.append ("Select S1 from table WHERE drainno= '" + Strdrainno + "'");
if (!string. IsNullOrEmpty (Strid))
{
Strsql.append ("and id!=" + Strid + "");
}

}
DataTable dt = new DataTable ();
DT = this. GetList (Strsql.tostring ());
if (dt! = null && dt. Rows.Count > 0)
{
return true;
}
Else
{
return false;
}
}

BLL Layer:


<summary>
Determine if a registration number exists
</summary>
<param name= "Strdrainno" > Registration number </param>
<returns></returns>
public bool Exit (string strdrainno,string strid)
{
Using Exitdal dal = new Exitdal ())
{
Return DAL. Exit (Strdrainno,strid);
}
}

As for the backstage code, think about it.

Use layer three to determine if the code in the SQL database already exists (personal my book, do not want to spray)

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.