读书人

请帮忙 在c#中sql语句写法解决方法

发布时间: 2012-01-21 21:31:43 作者: rapoo

请帮忙 在c#中sql语句写法
请问
string sqlStr= "select city,city1,addr2 from postcode where code= "&this.tb1.Text& " ";
其中this.tb1.Text是一个textbox的文本,编译无法通过,请问我该如何写
谢谢

[解决办法]
string sqlStr= "select city,city1,addr2 from postcode where code= ' "+this.tb1.Text+ " ' ";
[解决办法]
string sqlStr= "select city,city1,addr2 from postcode where code= " + this.tb1.Text;

[解决办法]
一楼是文本类型,也可是time类型,二楼是数值类型,看你的code类型,选择使用。记得给分。

[解决办法]
string sqlStr= "select city,city1,addr2 from postcode where code= ' "+this.tb1.Text+ " ' ";
也太了吧!!!
[解决办法]
string sqlStr= "select city,city1,addr2 from postcode where code= ' "+this.tb1.Text+ " ' ";
[解决办法]
string sqlStr= "select city,city1,addr2 from postcode where code= ' "+this.tb1.Text+ " ' ";
应该是这个

读书人网 >C#

热点推荐