各位大虾给分析以下错误的原因。 提示“miss connection or connectstring”var adoconnection1:TAdoconnection; adotable1:Tadotable; begin adoconnection1:=TAdoconnection.Create(nil); adotable1:=TAdotable.Create(nil);
try with adoconnection1 do begin ConnectionString:='Provider=SQLOLEDB.1;Persist Security info=False;User ID=sa;Initial Catalog=wlks;Data Source=ASKGOD'; connected:=true; loginprompt:=false; open('sa',''); end;
if adotable1.active then adotable1.close; adotable1.name:='alluser'; adotable1.open;/****就是一执行到这句就出错,去掉就可以了*****/ //adotable1.active:=true; showmessage('正确联结数据库'); except SHOWMESSAGE('失敗!'); end;
提示“miss connection or connectstring”var
adoconnection1:TAdoconnection;
adotable1:Tadotable;
begin
adoconnection1:=TAdoconnection.Create(nil);
adotable1:=TAdotable.Create(nil);
try
with adoconnection1 do
begin
ConnectionString:='Provider=SQLOLEDB.1;Persist Security
info=False;User ID=sa;Initial Catalog=wlks;Data Source=ASKGOD';
connected:=true;
loginprompt:=false;
open('sa','');
end;
if adotable1.active then adotable1.close;
adotable1.name:='alluser';
adotable1.open;/****就是一执行到这句就出错,去掉就可以了*****/
//adotable1.active:=true;
showmessage('正确联结数据库');
except
SHOWMESSAGE('失敗!');
end;
adotable1.tablename:='alluser';
adotable1.open;
================================================================