用DELPHI将VFP表格中的数据导入到ACCESS中后
在VFP表中日期是2006-09-06到了ACCESS中后变成了1905-06-11
VFP中字段类型是日期时间型,ACCESS中也是同样的
导入代码如下:
从VFP中取记录:
dm.AQVFP.Close;
dm.AQVFP.SQL.Clear;
dm.AQVFP.SQL.Add('select px.px_code,px.px_qty,px.px_unit,px.px_ref,' );
dm.AQvfp.SQL.add('px.px_ref2,px.px_ref3,px.px_ref4,px.px_re,px.px_mo,');
dm.AQvfp.SQL.Add('po.po_date,po.po_daccode from po,poxact as px ');
dm.AQvfp.SQL.Add('where px.px_code=po.po_code');
dm.AQvfp.open;
插入记录:
AQinto.Close;
AQinto.SQL.Clear;
AQinto.SQL.Add('insert into po values('''+AQvfp.Fields [0].asstring+''','+datetimetostr(AQvfp.Fields[9].AsDateTime)+',');
AQinto.SQL.Add(''''+AQvfp.Fields[8].asstring+''','''+AQvfp.Fields[3].asstring+''','''+AQvfp.Fields[5].asstring+''',');
AQinto.SQL.Add(''''+AQvfp.Fields[6].asstring+''','+IntToStr(AQvfp.Fields[1].AsInteger)+','''+AQvfp.Fields[4].asstring+''',');
AQinto.SQL.Add(''''+AQvfp.Fields[7].asstring+''')');
AQinto.ExecSQL;
showmessage(datetimetostr(AQvfp.Fields[9].AsDateTime));
Label5.Caption:='正在导入第'+inttostr(i)+'笔记录';
Label5.Update;
PB1.StepIt;
我SHOWMESSAGE的时候显示的日期也是正确的
大家帮帮忙看看有什么地方不对!
在VFP表中日期是2006-09-06到了ACCESS中后变成了1905-06-11
VFP中字段类型是日期时间型,ACCESS中也是同样的
导入代码如下:
从VFP中取记录:
dm.AQVFP.Close;
dm.AQVFP.SQL.Clear;
dm.AQVFP.SQL.Add('select px.px_code,px.px_qty,px.px_unit,px.px_ref,' );
dm.AQvfp.SQL.add('px.px_ref2,px.px_ref3,px.px_ref4,px.px_re,px.px_mo,');
dm.AQvfp.SQL.Add('po.po_date,po.po_daccode from po,poxact as px ');
dm.AQvfp.SQL.Add('where px.px_code=po.po_code');
dm.AQvfp.open;
插入记录:
AQinto.Close;
AQinto.SQL.Clear;
AQinto.SQL.Add('insert into po values('''+AQvfp.Fields [0].asstring+''','+datetimetostr(AQvfp.Fields[9].AsDateTime)+',');
AQinto.SQL.Add(''''+AQvfp.Fields[8].asstring+''','''+AQvfp.Fields[3].asstring+''','''+AQvfp.Fields[5].asstring+''',');
AQinto.SQL.Add(''''+AQvfp.Fields[6].asstring+''','+IntToStr(AQvfp.Fields[1].AsInteger)+','''+AQvfp.Fields[4].asstring+''',');
AQinto.SQL.Add(''''+AQvfp.Fields[7].asstring+''')');
AQinto.ExecSQL;
showmessage(datetimetostr(AQvfp.Fields[9].AsDateTime));
Label5.Caption:='正在导入第'+inttostr(i)+'笔记录';
Label5.Update;
PB1.StepIt;
我SHOWMESSAGE的时候显示的日期也是正确的
大家帮帮忙看看有什么地方不对!
还有一个问题问一下,就不另外开帖了
delphi中要查询VFP中的数据条件是2006-05-01至2006-09-01这段时间的数据
我怎么写都报错啊!
select * from 表 where 日期字段between'2005/12/12 and 2005/12/30
或
select * from 表 where convert(int,日期字段)>20051212 and
convert(int,日期字段)<20051230