下面是什么错误。
代码如下
MySQLCommand comm = new MySQLCommand("select count(*) from maivpn where name=" + txtname.Text + " and p=" + txtpwd.Text, conn);
try
{
conn.Open();
if (Convert.ToInt32(comm.ExecuteScalar()) <= 0)
{
comm.CommandText = "insert into maivpn values(" + txtname.Text + "," + txtpwd.Text + "," + "true)";
if (comm.ExecuteNonQuery() > 0)
{
MessageBox.Show("注册成功");
}
}
else
{
MessageBox.Show("注册失败,此账号可能已存在");
}
}
catch (Exception ee)
{
txtname.Text = ee.Message;
MessageBox.Show(ee.Message);
}
finally {
conn.Close();
}
有时候报MySQLDriverCS Exception: MySQLDriverCS Error: wrong query.Unknown column 'qwe' in 'where clause'
有时候下面的MySQLDriverCS Exception: MySQLDriverCS Error: wrong query.You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'w' at line 1
代码如下
MySQLCommand comm = new MySQLCommand("select count(*) from maivpn where name=" + txtname.Text + " and p=" + txtpwd.Text, conn);
try
{
conn.Open();
if (Convert.ToInt32(comm.ExecuteScalar()) <= 0)
{
comm.CommandText = "insert into maivpn values(" + txtname.Text + "," + txtpwd.Text + "," + "true)";
if (comm.ExecuteNonQuery() > 0)
{
MessageBox.Show("注册成功");
}
}
else
{
MessageBox.Show("注册失败,此账号可能已存在");
}
}
catch (Exception ee)
{
txtname.Text = ee.Message;
MessageBox.Show(ee.Message);
}
finally {
conn.Close();
}
有时候报MySQLDriverCS Exception: MySQLDriverCS Error: wrong query.Unknown column 'qwe' in 'where clause'
有时候下面的MySQLDriverCS Exception: MySQLDriverCS Error: wrong query.You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'w' at line 1
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货