Arsip: mengakses database access berpassword

 
user image
more 17 years ago

gito

mas2 gimana mengakses database access berpassword pk adoconnectionstring, jd pas dirun dah ga minta2 password lagi. thanks
user image
more 17 years ago

mas_kofa

1. user name ama password diset saat perancangan melalui property connecting string. 2. property connected diset true 3. dan property login prompt diset false
user image
more 17 years ago

tomboati


type
  TDBType = (dbtSQLServer, dbtMDB, dbDBF);
  public
    function ConnectDB(const FileName : TFileName; const DBType : TDBType; pwd : string = ''):boolean;
bla bla.........
function TDM.ConnectDB(const FileName: TFileName; const DBType : TDBType; pwd : string = ''): boolean;
var
  DBName : widestring;
  SQLConnection : TSQLConnection;
begin
  Result := False;
  if DBType = dbtMDB then
   begin
    AdoConn.ConnectionString:='Provider=Microsoft.Jet.OLEDB.4.0;Data Source=' + FileName + ';Persist Security Info=False';
    if pwd <> '' then AdoConn.ConnectionString:=AdoConn.ConnectionString + ';Jet OLEDB:Database Password=' + pwd;
    DBName := FileName;
  end;
  AdoConn.LoginPrompt := False;
  result:=True;
  MainForm.ConnectedTO := DBName;
  try
    if NOT AdoConn.Connected then AdoConn.Open;
    Result:=True;
  except
    ON E:Exception do
    begin
      MessageDlg(e.Message,mtError, [mbOK],0);
      MainForm.ConnectedTO := '';
      pwd := InputBox('MDB with password','If this is password protected, please enter password (leave empty to cancel):','');
      if pwd = '' then
      begin
        Result := false;
        Exit;
      end
      else
        if ConnectDB(FileName, DBType, pwd) then Result := True;
    end;
  end;
end; (ConnectDB )
Semoga membantu, http://tao.esaprima.com
user image
more 17 years ago

gito

terima kasih petunjuknya, saya sudah berhasil
more ...
  • Pages:
  • 1
Share to

AI Forward

🚀 We're thrilled to partner with Alibaba Cloud for "AI Forward - Alibaba Cloud Global Developer Summit 2025" in Jakarta! Join us and explore the future of AI. Register now: https://int.alibabacloud.com/m/1000400772/
#AlibabaCloud #DeveloperSummit #Jakarta #AIFORWARD

Random Topic

Local Business Directory, Search Engine Submission & SEO Tools FreeWebSubmission.com SonicRun.com