有关线程的一个小问题,大家帮帮忙啊!!!
我在form1(unit1)中有一个按钮onclick事件:
procedure TForm1.Button1Click(Sender: TObject);
var
newThread:testThread;
begin
newThread:=testThread.Create(false);
end;
新建了一个线程testThread文件(unit2):
procedure testThread.Execute;
var
mmadoquery:Tadoquery;
begin
mmadoquery:=Tadoquery.Create(application.Owner); mmadoquery.ConnectionString:='Provider=SQLOLEDB.1;Password=liyan;Persist Security Info=True;User ID=sa;Initial Catalog=photo2003;Data Source=LI_YAN_WOODS';
showmessage('OK');
end;
在mmadoquery.ConnectionString:=就出错了,showmessage('OK')就跳过了
报错:尚未调用coInitialize
帮帮忙啊!!只是在线程中动态创建了一个mmadoquery啊,这是不是因为线程的问题啊