不解呀,这个怎么出来的都是一个return false???
public bool CheckBaseUsed(string table,string fieldname,int fieldvalue)
{
SqlConnection cn =new SqlConnection(Properties.Settings.Default.bdtcConnectionString);
string sqlstr = "Select " + fieldname + " from " + table + " Where " + fieldname + " = " + fieldvalue;
SqlCommand cmd = new SqlCommand(sqlstr, cn);
int ResultI = 0;
try
{
cn.Open();
ResultI = cmd.ExecuteNonQuery();
cn.Close();
if (ResultI > 0)
{
return true;
}
else
{
return false;
}
}
catch
{
return false;
}
}
------解决方案--------------------select 查询语句怎么用ExecuteNonQuery呢?
http://home.cnblogs.com/group/topic/56649.html
------解决方案--------------------
用那个方法可以直接得到一个选择到的行数呢?什么意思