![]() | ![]() Products ![]() ![]() ![]() ![]() |
Home » Technical Support » ElevateDB Technical Support » Support Forums » ElevateDB General » View Thread |
Messages 1 to 2 of 2 total |
![]() |
Sun, Jun 24 2007 8:07 AM | Permanent Link |
"Felix Gartsman" | Hello,
I create a database on the fly and then want to connect to it. But despite successful creation I get error #401 - database not found. I attached a small reproducable D2007 project with 1.04b2 Std. The offending code: function DatabaseExists(AEDBSession: TEDBSession; const ADatabaseName: string): boolean; begin Assert(Assigned(AEDBSession)); Result := false; if Assigned(AEDBSession) then begin Result := AEDBSession.Execute('SELECT * FROM Databases ' + 'WHERE Name=' + Engine.QuotedSQLStr(ADatabaseName)) = 1; end; end; function CreateDatabase(AEDBSession: TEDBSession; const ADatabaseName, ADatabasePath: string; const ADatabaseDescription: string = ''): boolean; var CreateSQL: string; begin Assert(Assigned(AEDBSession)); Result := false; if Assigned(AEDBSession) then begin CreateSQL := 'CREATE DATABASE ' + AnsiQuotedStr(ADatabaseName, '"') + ' ' + 'PATH ' + AnsiQuotedStr(ADatabasePath, ''''); if ADatabaseDescription <> '' then begin CreateSQL := CreateSQL + ' DESCRIPTION ' + AnsiQuotedStr(ADatabaseDescription, ''''); end; AEDBSession.Execute(CreateSQL); Result := true; end; end; procedure TForm3.Button1Click(Sender: TObject); begin EDBEngine.Active := true; EDBSession.SessionName := 'Test'; EDBSession.LoginUser := 'Administrator'; EDBSession.LoginPassword := 'EDBDefault'; EDBSession.Connected := true; if not DatabaseExists(EDBSession, 'Test') then begin CreateDatabase(EDBSession, 'Test', EDBEngine.ConfigPath); if not DatabaseExists(EDBSession, 'Test') then begin Application.MessageBox('Bad', 'Bad');// NEVER COMES HERE??? end; end; EDBDatabase.SessionName := EDBSession.SessionName; EDBDatabase.DatabaseName := 'Test'; EDBDatabase.Connected := true; // **************************** ERROR #401 HERE!!! end; Is it my wrong usage or a bug? Felix Attachments: DBTest.zip |
Mon, Jun 25 2007 5:20 PM | Permanent Link |
Tim Young [Elevate Software] Elevate Software, Inc. ![]() | Felix,
<< I create a database on the fly and then want to connect to it. But despite successful creation I get error #401 - database not found. I attached a small reproducable D2007 project with 1.04b2 Std. The offending code: >> Add this line: EDBDatabase.SessionName := EDBSession.SessionName; EDBDatabase.DatabaseName := 'Test'; EDBDatabase.Database := 'Test'; <<<<<<<<<<<<<<<<<<< Here EDBDatabase.Connected := true; -- Tim Young Elevate Software www.elevatesoft.com |
This web page was last updated on Wednesday, August 14, 2024 at 03:12 PM | Privacy Policy![]() © 2024 Elevate Software, Inc. All Rights Reserved Questions or comments ? ![]() |