Bernt Wold
2008-10-08 22:43:07 UTC
Hello,
I have One Tsqlconnection and I would like to change the default
database(schema) it's pointing to.
I am using Deplhi 9, MSSQL2008 and dbexpress
Here is an example of what I am trying to do...
Connecting....
SQLConnection.Params.Clear;
SQLConnection.DriverName := 'MSSQL';
SQLConnection.GetDriverFunc := 'getSQLDriverMSSQL';
SQLConnection.LibraryName := 'dbxmss.dll';
SQLConnection.VendorLib := 'oledb';
SQLConnection.Params.Append('Database=test1');
SQLConnection.Params.Append('User_Name=user');
SQLConnection.Params.Append('Password=1234');
SQLConnection.Params.Append('HostName=sqlexpress');
SQLConnection.LoginPrompt:=false;
SQLConnection.Open;
Doing som work..
sqlquery1.SQLConnection:=SQLConnection;
sqlquery1.SQL.Clear;
sqlquery1.SQL.Add('UPDATE......');
sqlquery1.ExecSQL()
sqlquery1.Close;
Now I would like to change the default database for SQLconnection....
from test1 to SQLConnection.Params.Append('Database=test2');
Then continue with same work in another database using the same
connector..
Doing som work..
sqlquery1.SQLConnection:=SQLConnection;
sqlquery1.SQL.Clear;
sqlquery1.SQL.Add('UPDATE......');
sqlquery1.ExecSQL()
sqlquery1.Close;
Is this possible, if so where do I change the default
database(Schema), if not any other Idea how to do this.. Thanks in
advance..
Regards
B
I have One Tsqlconnection and I would like to change the default
database(schema) it's pointing to.
I am using Deplhi 9, MSSQL2008 and dbexpress
Here is an example of what I am trying to do...
Connecting....
SQLConnection.Params.Clear;
SQLConnection.DriverName := 'MSSQL';
SQLConnection.GetDriverFunc := 'getSQLDriverMSSQL';
SQLConnection.LibraryName := 'dbxmss.dll';
SQLConnection.VendorLib := 'oledb';
SQLConnection.Params.Append('Database=test1');
SQLConnection.Params.Append('User_Name=user');
SQLConnection.Params.Append('Password=1234');
SQLConnection.Params.Append('HostName=sqlexpress');
SQLConnection.LoginPrompt:=false;
SQLConnection.Open;
Doing som work..
sqlquery1.SQLConnection:=SQLConnection;
sqlquery1.SQL.Clear;
sqlquery1.SQL.Add('UPDATE......');
sqlquery1.ExecSQL()
sqlquery1.Close;
Now I would like to change the default database for SQLconnection....
from test1 to SQLConnection.Params.Append('Database=test2');
Then continue with same work in another database using the same
connector..
Doing som work..
sqlquery1.SQLConnection:=SQLConnection;
sqlquery1.SQL.Clear;
sqlquery1.SQL.Add('UPDATE......');
sqlquery1.ExecSQL()
sqlquery1.Close;
Is this possible, if so where do I change the default
database(Schema), if not any other Idea how to do this.. Thanks in
advance..
Regards
B