我写了几个数据库程序,每次打开都要提示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;

解决方案 »

  1.   

    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 := True;
          end;
       except
          MessageBox(handle,'数据库连接失败','出错啦!!!',20);
          exit;
       end;
    end;
      

  2.   

    不好意思写错了
    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;
      

  3.   

    ADOConnection1.LoginPrompt := False;
      

  4.   

    ADOConnection1.LoginPrompt := False;
      

  5.   

    ADOConnection1.LoginPrompt := False;
    设置后不会出现登陆对话框
      

  6.   

    ADOConnection1.LoginPrompt := False;
    应该没问题的