Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

connecting to Sql server database

Status
Not open for further replies.

avbnet

Programmer
Feb 5, 2003
5
0
0
TR
I want to connect SQL Server database during runtime.User will input "database","server","password" and "UserID" via a form.I'm using sql server 2000 and Delphi 4 standart edition.Since the standart edition doesn't support connecting to SQL server, i installed ADO component introduced by Deersoft.i need to get the collection of tables of the database connected.But i couldn't manage to do this with ADO component i installed.Can anybody tell me the way to do this.Thank you.
 
hi

I haven't used ADO AND assuming it's something like TDatabase (is it?), wouldn't something like the following do the trick ?

Create different ODBC datasources for each server

Then
Database1.LoginPrompt:=False;

if edServer.text = 'Server1' then
begin
Database1.DatabaseName:='ODBCDatasource1';
// Database1.AliasName:=ALIAS; //not sure if you'd need this
end;

if edServer.text = 'Server2' then
begin
Database1.DatabaseName:='ODBCDatasource2';
end;

Database1.Params.Add('USER NAME='+username);
Database1.Params.Add('PASSWORD='+password);


Ignore me if I'm talking complete garbage, like I said, I haven't used ADO before so unsure.

lou
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top