读书人

没法将类型“bool”隐式转换为“Syste

发布时间: 2012-08-17 02:08:34 作者: rapoo

无法将类型“bool”隐式转换为“System.Data.DataTable
public Boolean readUserinfo(string tname, string tpassword)
{
string[]tuserinfo=new string[3];
string sqlcommand = "select*from Member where UserName'"+tname+"'and Password='"+tpassword+"'";
ShoppingCart DB = new ShoppingCart();

DataTable dt = DB.ExceRead(sqlcommand);
if (dt.Rows.Count > 0)
return true;
else
return false;
}

错误3无法将类型“bool”隐式转换为“System.Data.DataTable”这是什么意思啊,应该怎么改!!求大虾指点!!

[解决办法]
DB.ExceRead返回应该是bool类型的

DataTable dt = DB.ExceRead(sqlcommand);
if (dt.Rows.Count > 0)
return true;
else
return false;

改成

return DB.ExceRead(sqlcommand);

读书人网 >asp.net

热点推荐