PDA

View Full Version : db connections


RwD
09-27-2001, 09:59 AM
Hi, I use the following code in my program:

// eConnected = True;
Database.DatabaseName:= Form1.Settings.DatabaseName;
Database.AliasName:= Form1.Settings.DatabaseAliasName;
Database.Connected:= eConnected;

// Queries:
Survey_questions.SQL.Text:= 'Select * From ' + Form1.Settings.DatabaseName + '.dbo.Survey_questions';
Survey_questions.Active:= eConnected;

loginprompt = false, and still I get one. I know why this is: after the databse has connected, the query's active property is set to true, and it tries to connect to the same db. And that's when, and why I get the login prompt.

but that doesn't make sense because I'm already connected, right? if I take the "' + Form1.Settings.DatabaseName + '." out of the query's text, it works without a prompt, but when I change databases (so going to another database with a different name) the query doesn't seem to get this, and it stays connected to the old db

does anybody know the solution for this?

tnx,
RwD

MrBaseball34
09-27-2001, 11:08 AM
Did you set the Query's DataBaseName to the Database.DatabaseName?

RwD
09-27-2001, 12:06 PM
I was trying some settings, actually just goofing around, and suddenly it didn't ask anymore, it was the db name, but I thought in the query that setting was overwritten anyway, guess I was partially wrong...

tnx,
RwD