c#组合框的值和数据库内int字段的比较如何进行

c#组合框的值和数据库内int字段的比较如何进行,就是把组合框的值与一个int型的字段进行比较,类型上总是出错。怎么回事?
int no = Convert.ToInt32(cboDiffClass.Text);
string sql = "select QuestionId ,Question ,OptionA ,OptionB ,OptionC ,OptionD From Question where no=Difficulty";
DBHelper.connection.Open();
这里边总是提示列名no无效

数据库查询语句错了 where no=Difficulty 你的Question表没有 no字段
温馨提示:答案为网友推荐,仅供参考
第1个回答  2009-12-07
SQL语句写错了,应该为:
string sql = "select QuestionId ,Question ,OptionA ,OptionB ,OptionC ,OptionD From Question where Difficulty = " + no.ToString();

相关了解……

你可能感兴趣的内容

本站内容来自于网友发表,不代表本站立场,仅表示其个人看法,不对其真实性、正确性、有效性作任何的担保
相关事宜请发邮件给我们
© 非常风气网