判断数据库中的表记录是否为空

判断数据库中的表记录是否为空
select count(*) from Table

public bool IsNoWorkSheetID(string OriOrderID)
        {
              string   sql =   "select count(*) from WorkSheet where OriOrderID = '"   + OriOrderID +   "'"   ;
              Database   db =   DatabaseFactory   .CreateDatabase();
              DBCommandWrapper   cmd = db.GetSqlStringCommandWrapper(sql);
              DataSet   dt =   new   DataSet ();

            dt = db.ExecuteDataSet(cmd);
              DataTable   dta = dt.Tables[0];
              string   id = dta.Rows[0][0].ToString();
              if   (id ==   "0"   )
                  return   true   ;
              else
                  return   false   ;
        }

你可能感兴趣的:(C#,SQL)