DR = cmd.ExecuteScalar();是进行错误并返回错误请检查并解决此错误先生 [英] dr=cmd.ExecuteScalar(); it is conduct the error and return a conduct the error please check and solve this error sir please
本文介绍了DR = cmd.ExecuteScalar();是进行错误并返回错误请检查并解决此错误先生的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
public int membercount(string tbl, string condition)
{
string query = null;
if (condition.Trim().Length > 0)
{
query = query + "where" + condition;
}
else
{
query = query;
}
cmd = new SqlCommand(query, con);
dr = cmd.ExecuteScalar();
return a;
}
'
[edit]已添加代码块[/ edit]
´
[edit]Code block added[/edit]
推荐答案
在代码中......即使查询
为null,你也会传递给cmd
并且你正试图执行查询...可能是错误..尝试为查询
指定一些值如果它是Null ..或者你可以在中执行
cond 'ncmd
if(condition.Trim()。Length> 0)
希望这个解释有效......
In the Code.... Even thoughquery
is null u are passing tocmd
and u are trying to execute query... May be it's the error.. Try assign some value toquery
if it's Null.. or u can executecmd
inif (condition.Trim().Length > 0)
cond'n
Hope this explanation Works...
这篇关于DR = cmd.ExecuteScalar();是进行错误并返回错误请检查并解决此错误先生的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文