Hi
I have a problem with my connection on SqlServer
I will like to use 2 tables on 2 bases different on the same serveur Mssql.
Do you have example to connect 2 bases on the same server and after connection use 2 tables
One Base is easy. How do you do for the second base to connect.
Excuse my English...
Mario
Use 2 bases on same server
Re: Use 2 bases on same server
hello,
To access tables from different databases using one connection, you should explicitly specify database names before table names, for example:
Or use 'Use' to specify the database you want to work with:
P.S. The user, under which you are logging in the server, must have proper rights for the used databases.
To access tables from different databases using one connection, you should explicitly specify database names before table names, for example:
Code: Select all
SELECT * FROM Northwind.dbo.Products;Code: Select all
USE Northwind;
SELECT * FROM dbo.Products;Re: Use 2 bases on same server
Tank you
I have one question again
My application use a MsTable and Msdatasource for my first base no problem my connection
use Msconnection1 to connect my server and base How to connect the second base with MsTable
Base one
1= MsTable1.tablename:='Nom' because Table1 is connect on first base
Base two
2= MsTable2.tablename:='adresse' or MsTable2.tablename:='Base2.adresse.dbo'
Thank you again
Mario
I have one question again
My application use a MsTable and Msdatasource for my first base no problem my connection
use Msconnection1 to connect my server and base How to connect the second base with MsTable
Base one
1= MsTable1.tablename:='Nom' because Table1 is connect on first base
Base two
2= MsTable2.tablename:='adresse' or MsTable2.tablename:='Base2.adresse.dbo'
Thank you again
Mario
-
AndreyZ
Re: Use 2 bases on same server
Here is a code example:
Code: Select all
MSTable1.TableName := 'DatabaseName1.SchemaName1.TableName1';
MSTable2.TableName := 'DatabaseName2.SchemaName2.TableName2';Re: Use 2 bases on same server
Thank you
I appreciate your support
Your explains was very good.My test is ok.
Thank again
Mario
I appreciate your support
Your explains was very good.My test is ok.
Thank again
Mario
-
AndreyZ
Re: Use 2 bases on same server
I am glad I could help. If any other questions come up, please contact us.