Exists出现找不到表的原因,于是换了个写法
/// <summary>
/// 是否存在该记录
/// </summary>
public bool Exists(string QT_NO, string PRD_NO)
{
StringBuilder strSql = new StringBuilder();
strSql.Append("select count(1) as gets from OP_QT_ITM_TempOrderBy ");
strSql.Append(" where QT_NO=@QT_NO and PRD_NO=@PRD_NO ");
SqlParameter[] parameters = {
new SqlParameter("@QT_NO", SqlDbType.VarChar,50),
new SqlParameter("@PRD_NO", SqlDbType.VarChar,50)};
parameters[0].Value = QT_NO;
parameters[1].Value = PRD_NO;
DataSet ds = DbHelperSQL.Query(strSql.ToString(), parameters);
if (ds.Tables[0].Rows.Count > 0)
{
if (int.Parse(ds.Tables[0].Rows[0]["gets"].ToString()) > 0)
{
return true;
}
else
{
return false;
}
}
else
{
return false;
}
}
/// 是否存在该记录
/// </summary>
public bool Exists(string QT_NO, string PRD_NO)
{
StringBuilder strSql = new StringBuilder();
strSql.Append("select count(1) as gets from OP_QT_ITM_TempOrderBy ");
strSql.Append(" where QT_NO=@QT_NO and PRD_NO=@PRD_NO ");
SqlParameter[] parameters = {
new SqlParameter("@QT_NO", SqlDbType.VarChar,50),
new SqlParameter("@PRD_NO", SqlDbType.VarChar,50)};
parameters[0].Value = QT_NO;
parameters[1].Value = PRD_NO;
DataSet ds = DbHelperSQL.Query(strSql.ToString(), parameters);
if (ds.Tables[0].Rows.Count > 0)
{
if (int.Parse(ds.Tables[0].Rows[0]["gets"].ToString()) > 0)
{
return true;
}
else
{
return false;
}
}
else
{
return false;
}
}
附上原来的代码,晕死了!这个应该不会错才是
/// <summary>
/// 是否存在该记录
/// </summary>
public bool Exists(string QT_NO,string PRD_NO)
{
StringBuilder strSql=new StringBuilder();
strSql.Append("select count(1) from OP_QT_ITM_TempOrderBy");
strSql.Append(" where QT_NO=@QT_NO and PRD_NO=@PRD_NO ");
SqlParameter[] parameters = {
new SqlParameter("@QT_NO", SqlDbType.VarChar,50),
new SqlParameter("@PRD_NO", SqlDbType.VarChar,50)};
parameters[0].Value = QT_NO;
parameters[1].Value = PRD_NO;
return DbHelperSQL.Exists(strSql.ToString(),parameters);
}
/// 是否存在该记录
/// </summary>
public bool Exists(string QT_NO,string PRD_NO)
{
StringBuilder strSql=new StringBuilder();
strSql.Append("select count(1) from OP_QT_ITM_TempOrderBy");
strSql.Append(" where QT_NO=@QT_NO and PRD_NO=@PRD_NO ");
SqlParameter[] parameters = {
new SqlParameter("@QT_NO", SqlDbType.VarChar,50),
new SqlParameter("@PRD_NO", SqlDbType.VarChar,50)};
parameters[0].Value = QT_NO;
parameters[1].Value = PRD_NO;
return DbHelperSQL.Exists(strSql.ToString(),parameters);
}
DbHelperSQL.RunProcedure 的应用
想給自己的blog換個標題,想給自己換個心情!

我自己写的博客用的codehighlighter,博客园就用的那个.不过懒,写很久一直没弄完.哈哈