database('provider=microsoft.jet.oledb.4.0;data source=d:\test.mdb');
dbexecute('insert into Test(stockdate) values('+numtostr(date,0)+')');
dbexecute('insert into Test(stockdate,stockopen,stockhigh,stocklow,stockclose,stockvolume) values('+numtostr(date,0)+','+numtostr(open,0)+','+numtostr(high,0)+','+numtostr(low,0)+','+numtostr(close,0)+','+numtostr(vol,0)+')');
红色语句成功插入数据,而绿色语句没有成功插入数据,怎么回事?
test.mdb 在 http://u.115.com/file/t8f2a7ec31
使用DEBUGFILE输出字符串看看,一般是SQL语句的语法问题或者数据库字段填写不正确。
database('provider=microsoft.jet.oledb.4.0;data source=d:\dbdemo\test.mdb');
sql:='insert into test(stockdate,stockopen,stockhigh,stocklow,stockclose,stockvolume) values('+numtostr(date,0)+','+numtostr(open,0)+','+numtostr(high,0)+','+numtostr(low,0)+','+numtostr(close,0)+','+numtostr(vol,0)+')';
dbexecute(sql);
已成功插入,不过stockdate怎么是这样的?怎么把日期正确插入?谢谢