输入中文的时候..错误提示 列名小龙无效
int num = 0;
try
{
string sql = string.Format("select count(*) from login where name={0} and paw={1}", textBox1.Text.Trim(),textBox2.Text.Trim());
SqlCommand com = new SqlCommand(sql, Dbhelp.con);
Dbhelp.con.Open();
num = Convert.ToInt32(com.ExecuteScalar());
MessageBox.Show(sql);
}
catch (Exception ex)
{
Console.WriteLine(ex.Message);
MessageBox.Show(ex.Message);
}
finally
{
Dbhelp.con.Close();
}
if(num==11)
{
MessageBox.Show("Fuck you");
}
输入中文的时候..错误提示 列名小龙无效
------解决方案--------------------
缺引号
where name='{0}' and paw='{1}'