delphi access 数据类型

来源:百度知道 编辑:UC知道 时间:2024/06/07 02:43:17
数据库是slq server是对的,但是用access数据库时,就不能正确执行,

请问怎么办?

procedure TForm3.ComboBox1Change(Sender: TObject);
begin
if DataModule2.adoquery2.FieldByName(combobox1.Text).DataType
in [ftunknown,ftmemo,ftstring] then
begin
edit1.Visible:=true;
DateTimePicker1.visible:=false;
combobox2.Clear;
combobox2.Items.Add('=');
combobox2.Items.Add('like');
end
else if DataModule2.adoquery2.FieldByName(combobox1.Text).DataType
in [ftinteger,ftword,ftsmallint,ftfloat,ftcurrency,ftautoinc] then
begin
edit1.Visible:=true;
DateTimePicker1.visible:=false;
combobox2.Clear;
combobox2.Items.Add('=');
combobox2.Items.Add('>');
combobox2.Items.Add('<');
combobox2.Items.Add('<>');
end
else if DataModule2.adoquery2.FieldByNa

因Sql Servre和Access数据库的语法相似,但还是有一定的区别的。所以在Sql Server中能执行,但在Access没有遵循Access的语法就就有错。

日期型字读的话, 在 ACCESS 中,使用的时候,不是用 单引号包括的,而使用#

例如:

SELECT * FROM 表 WHERE 日期字段 = #2009-3-22#