int count = Convert.ToInt32(cmd.ExecuteScalar());输入字符串的格式不正确
stringACCESS_CONN_STRING="UID=root;PassWord=sec1234;PORT=3306;DATABASE=healthcenter;S...
string ACCESS_CONN_STRING = "UID=root;PassWord=sec1234;PORT=3306;DATABASE=healthcenter;SERVER=222.29.213.32;CHARSET=utf8";
using (MySqlConnection conn = new MySqlConnection(ACCESS_CONN_STRING))
{
string sql_MysqlCount = "select user_name,user_idNumber from User where user_name='" + hwexamername + "' and user_idNumber ='" + mysqldatsinfo + " '";
MySqlCommand cmd = new MySqlCommand(sql_MysqlCount, conn);
conn.Open();
int count = Convert.ToInt32(cmd.ExecuteScalar());
呵呵 谢谢 但是数据库表里面有相同的数据 int count = Convert.ToInt32(cmd.ExecuteScalar());这个取出来应该是count >0,但是现在是count =0 不知道怎么回事 展开
using (MySqlConnection conn = new MySqlConnection(ACCESS_CONN_STRING))
{
string sql_MysqlCount = "select user_name,user_idNumber from User where user_name='" + hwexamername + "' and user_idNumber ='" + mysqldatsinfo + " '";
MySqlCommand cmd = new MySqlCommand(sql_MysqlCount, conn);
conn.Open();
int count = Convert.ToInt32(cmd.ExecuteScalar());
呵呵 谢谢 但是数据库表里面有相同的数据 int count = Convert.ToInt32(cmd.ExecuteScalar());这个取出来应该是count >0,但是现在是count =0 不知道怎么回事 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询