首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > .NET > C# >

输入中文的时候.异常提示 列名小龙无效

2012-08-26 
输入中文的时候..错误提示 列名小龙无效int num 0try{string sql string.Format(select count(*) fr

输入中文的时候..错误提示 列名小龙无效
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}'

热点排行