我把动态创建数据库做成dll(附代码),在form中以这种形式写是对的,如果把他作成dll调用时老是出现错误“尚未调用Cointialize”?(35分)

  • 主题发起人 主题发起人 yaxexe
  • 开始时间 开始时间
Y

yaxexe

Unregistered / Unconfirmed
GUEST, unregistred user!
清高手指点。
/////.....dll
function search():integer;stdcall;
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';
loginprompt:=false;
open('sa','');
end;
if adotable1.active then adotable1.close;
adotable1.connection:=adoconnection1;
adotable1.tablename:='alluser';
adotable1.open;
adotable1.append;
adotable1.fieldbyname('uid').asstring:='96111112';
adotable1.Post;
search:=1;
except
search:=2;
end;
end;
exports
search;
///////。。。。。调用时的函数
function search():integer;
stdcall;external 'true.dll';
procedure TForm1.Button1Click(Sender: TObject);
begin
Edit1.text:=inttostr(search());
end;
 
后退
顶部