sql 出错
我用编辑框输入号码,在回车后想在DBgrid中显示对应的记录,用了Query,使用的Access数据库,运行时出示错误:
project project1.exe raised exception class EDBEngineError with message 'General SQL error.[Mirosoft][ODBC Microsoft Access Driver]标准表达式中数据类型不匹配。'process stopped
代码如下:
procedure TForm1.Edit1KeyDown(Sender: TObject; var Key: Word;
Shift: TShiftState);
var s:string;
begin
s:=edit1.text;
if key=13 then
begin
with Query1 do
begin
close;
SQL.clear;
SQL.add('select * from ydy where hm='+s);
open;
end;
end;
end;