知 知秋 Unregistered / Unconfirmed GUEST, unregistred user! 2009-03-28 #1 在程序中动态创建表后,立即读取该表,Access却提示刚创建的表不存在(实际上表已经创建好了),这个问题该怎么解决?
Z znxia Unregistered / Unconfirmed GUEST, unregistred user! 2009-03-28 #2 有吗?我测试正常,代码如下:procedure TForm1.Button1Click(Sender: TObject);begin Query1.SQL.text:='create table a( '+ ' id integer )'; Query1.ExecSQL; Query1.SQL.Text:='Select count(*) from a'; Query1.open; caption:=inttostr(Query1.fields[0].asinteger);end;
有吗?我测试正常,代码如下:procedure TForm1.Button1Click(Sender: TObject);begin Query1.SQL.text:='create table a( '+ ' id integer )'; Query1.ExecSQL; Query1.SQL.Text:='Select count(*) from a'; Query1.open; caption:=inttostr(Query1.fields[0].asinteger);end;
Z znxia Unregistered / Unconfirmed GUEST, unregistred user! 2009-03-28 #3 ADO代码也正常:procedure TForm1.Button1Click(Sender: TObject);begin ADOCommand1.CommandText:='create table a( '+ ' id integer )'; ADOCommand1.Execute;; ADOQuery1.SQL.Text:='Select count(*) from a'; ADOQuery1.open; caption:=inttostr(ADOQuery1.fields[0].asinteger);end;
ADO代码也正常:procedure TForm1.Button1Click(Sender: TObject);begin ADOCommand1.CommandText:='create table a( '+ ' id integer )'; ADOCommand1.Execute;; ADOQuery1.SQL.Text:='Select count(*) from a'; ADOQuery1.open; caption:=inttostr(ADOQuery1.fields[0].asinteger);end;
知 知秋 Unregistered / Unconfirmed GUEST, unregistred user! 2009-03-29 #4 创建了多个表。每次都是最后一个表访问有问题,前面创建的表读取没有问题,很奇怪。