日期:2014-05-20  浏览次数:20906 次

新手求助
SQL语句:select   *   from   EmployyInfo   where   EmployyId   =1
SqlCommand   command   =   new   SqlCommand( "select   *   from   EmployyInfo   where ' "+this.comboBox1.text+ " '= ' "+this.textBox1.Text+ " ' ",   MyCon);  
当我在combobox1中输入   "EmployyId "     在this.textbox1.text中输入 "1 "时   我想检索   EmployyInfo表中EmployyId为1   的记录   这条语句不能实现.
要怎么写呢?谢谢

------解决方案--------------------
去掉单引号
------解决方案--------------------
SqlCommand command = new SqlCommand( "select * from EmployyInfo where "
+ this.comboBox1.text + "= ' "+this.textBox1.Text+ " ' ", MyCon);

这样可以了