W
wlyft
Unregistered / Unconfirmed
GUEST, unregistred user!
我用以下这种方式连接access数据库
var
CreateAccess:OleVariant;
begin
CreateAccess:=CreateOleObject('ADOX.Catalog');
adoconnection1.ConnectionString:='Provider=Microsoft.Jet.OLEDB.4.0;Data Source=E:/userinfo.mdb;Persist Security Info=False';
adoconnection1.Open;
adoconnection1.Connected :=true;
end;
然后执行以下操作:
with ADOQuery1 do
begin
try
close;
sql.Clear;
sql.add('select top 1 * from acuserinfo');
open;
label1.Caption := FieldByName('nameid').AsString;
label2.caption := FieldByName('niname').AsString;
close;
sql.Clear;
sql.add('select * from acuserinfo where allowcutpic="1"');
open;
label3.caption :=FieldByName('nameid').AsString;
close;
sql.Clear;
sql.add('select * from acuserinfo');
open;
except
showmessage('error');
end;
end;
在有的机子上很正常(win98/2000)但有的机子(win98/2000)就会出如下错误
已试过多次了!!!不知为什么,我试过把win98的机子重装后就不会
w2k系统同是adv ser的公司那台不会错,家里这台就会错了!!
怎么回事????????
project project1.exe raised exception class EOLeException with message'BOF 或
EOF 中有一个是"真",或者当前的记录被删除,所需的操作要求一个当前的记录。',process stopped.
use step or run to continue.
var
CreateAccess:OleVariant;
begin
CreateAccess:=CreateOleObject('ADOX.Catalog');
adoconnection1.ConnectionString:='Provider=Microsoft.Jet.OLEDB.4.0;Data Source=E:/userinfo.mdb;Persist Security Info=False';
adoconnection1.Open;
adoconnection1.Connected :=true;
end;
然后执行以下操作:
with ADOQuery1 do
begin
try
close;
sql.Clear;
sql.add('select top 1 * from acuserinfo');
open;
label1.Caption := FieldByName('nameid').AsString;
label2.caption := FieldByName('niname').AsString;
close;
sql.Clear;
sql.add('select * from acuserinfo where allowcutpic="1"');
open;
label3.caption :=FieldByName('nameid').AsString;
close;
sql.Clear;
sql.add('select * from acuserinfo');
open;
except
showmessage('error');
end;
end;
在有的机子上很正常(win98/2000)但有的机子(win98/2000)就会出如下错误
已试过多次了!!!不知为什么,我试过把win98的机子重装后就不会
w2k系统同是adv ser的公司那台不会错,家里这台就会错了!!
怎么回事????????
project project1.exe raised exception class EOLeException with message'BOF 或
EOF 中有一个是"真",或者当前的记录被删除,所需的操作要求一个当前的记录。',process stopped.
use step or run to continue.