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)