我写了几个数据库程序,每次打开都要提示Database login登陆是怎么回事?怎么取他呢。。我数据库连接写在程序里面的,详细如下:
procedure TForm1.FormCreate(Sender: TObject);
begin
//连接数据库程序
localConnection := 'Provider=SQLOLEDB.1;Password=aa;Persist Security Info=True;User ID=aa;Initial Catalog=aa;Data Source=AA';
threadlist := tlist.Create();
try
with ADOConnection1 do
begin
ConnectionString := localConnection;
Connected := true;
end;
except
MessageBox(handle,'数据库连接失败','出错啦!!!',20);
exit;
end;
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
//连接数据库程序
localConnection := 'Provider=SQLOLEDB.1;Password=aa;Persist Security Info=True;User ID=aa;Initial Catalog=aa;Data Source=AA';
threadlist := tlist.Create();
try
with ADOConnection1 do
begin
ConnectionString := localConnection;
Connected := true;
end;
except
MessageBox(handle,'数据库连接失败','出错啦!!!',20);
exit;
end;
end;
begin
//连接数据库程序
localConnection := 'Provider=SQLOLEDB.1;Password=aa;Persist Security Info=True;User ID=aa;Initial Catalog=aa;Data Source=AA';
threadlist := tlist.Create();
try
with ADOConnection1 do
begin
ConnectionString := localConnection;
Connected := true;
LoginPrompt := True;
end;
except
MessageBox(handle,'数据库连接失败','出错啦!!!',20);
exit;
end;
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
//连接数据库程序
localConnection := 'Provider=SQLOLEDB.1;Password=aa;Persist Security Info=True;User ID=aa;Initial Catalog=aa;Data Source=AA';
threadlist := tlist.Create();
try
with ADOConnection1 do
begin
ConnectionString := localConnection;
Connected := true;
LoginPrompt := False;
end;
except
MessageBox(handle,'数据库连接失败','出错啦!!!',20);
exit;
end;
end;
设置后不会出现登陆对话框
应该没问题的