access数据库中表名是:表1。有一个字段名是:时间。字段的类型是:‘时间日期’型的。
我用sql语句查询:'select * from 表1 where 时间='''+datetostr(datetimepicker1.date)+''''
就报错说:“标准表达式中的数据类型不匹配”
这是怎么回事啊?
...全文
757打赏收藏
各位大哥大姐帮帮忙!!!!在线等。。。。。。。
access数据库中表名是:表1。有一个字段名是:时间。字段的类型是:‘时间日期’型的。 我用sql语句查询:'select * from 表1 where 时间='''+datetostr(datetimepicker1.date)+'''' 就报错说:“标准表达式中的数据类型不匹配” 这是怎么回事啊?
procedure TForm1.Button1Click(Sender: TObject);
var
tempstr:string;
begin
tempstr:='select * from 表1 where 时间=:temp1';
with ADOQuery1 do begin
close;
sql.Add(tempstr);
Parameters.ParamByName('temp1').Value:=FormatDateTime('yyyy-mm-dd',DateTimePicker1.DateTime);
Open;
end;//end adoquery1
end;
adoquery1.Close;
adoquery1.SQL.Clear;
adoquery1.SQL.Add('select * from 表1 where 时间='''+datetostr(datetimepicker5.Date)+'''');
adoquery1.Open;
错误信息:“标准表达式中的数据类型不匹配”
tempstr:='select * from 表1 where 时间=:temp1';
sql.Add(tempstr);
Parameters.ParamByName('temp1').Value:=FormatDateTime('yyyy-mm-dd',DateTimePicker2.DateTime);
Open;