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

Delphi 中SQL语句的有关问题

2012-04-28 
Delphi 中SQL语句的问题SQL:SELECT * from system_table WHERE UserId+Edit1.TextUserId类型为varcha

Delphi 中SQL语句的问题
SQL:='SELECT * from system_table WHERE UserId='+Edit1.Text;
UserId类型为varchar(30)
DBMS为SQL Server2005
Edit1中输入1或001,都能检索到表中UserId为001的项,请问一下是什么地方出错了?

[解决办法]
SQL:='SELECT * from system_table WHERE UserId='+QuotedStr(Edit1.Text);

[解决办法]
SQL:='SELECT * from system_table WHERE UserId='+QuotedStr(Edit1.Text);

SQL:='SELECT * from system_table WHERE UserId='''+Edit1.Text+'''';

对于这类问题自己用showmessage(sql);看看出来的SQL语句就知道啦!

热点排行