我尝试从表中获取行数:
string commandLine = "SELECT COUNT(*) FROM client";
using (MysqLConnection connect = new MysqLConnection(connectionStringMysqL))
using (MysqLCommand cmd = new MysqLCommand(commandLine,connect))
{
connect.Open();
int count = (int)cmd.ExecuteScalar();
return count;
}
我得到了例外:
Specified cast is not valid.
知道我怎么解决它?
最佳答案