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

新手

2012-01-19 
新手求助SQL语句:select*fromEmployyInfowhereEmployyId1SqlCommandcommandnewSqlCommand( select*from

新手求助
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);

这样可以了

热点排行