本人.Net新手,初学三层便想记录写笔记,以供像自己一样的新人去学习,大神就不用看啦
Dal层:
/// 判断编码是否存在
/// </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层:
/// <summary>
/// 判断是否存在登记编号
/// </summary>
/// <param name="strDrainNo">登记编号</param>
/// <returns></returns>
public bool Exit(string strDrainNo,string strID)
{
using ExitDal dal = new ExitDal())
{
return dal.Exit(strDrainNo,strID);
}
}
至于后台代码,想想就会了