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语句就知道啦!