Click here to Skip to main content
15,885,546 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Dear friends

i want to fetch the value on same page from two different database on the same server with different username and password for database,how can i do that..?
Posted
Comments
Mohibur Rashid 21-Sep-12 4:36am    
Well, I believe that same method is applicable as fetching from one database
ambujmalviya 21-Sep-12 5:09am    
i can do same as for one database but problem is that on my page where i already fetch value from four different table. and when i want to add this database then my some table are not working properly.so i facing problem in display.
Mohibur Rashid 21-Sep-12 5:13am    
Working properly does not make sense. Show us the query. and also show us what data you expect and what result you are getting
I.explore.code 21-Sep-12 4:53am    
just like you do for one database.
ambujmalviya 21-Sep-12 5:09am    
i can do same as for one database but problem is that on my page where i already fetch value from four different table. and when i want to add this database then my some table are not working properly.so i facing problem in display.

Hi there,
If the two databases from which you want to get values from are on two different DB instances (on the same server), then you need to script a database connection string that uses each instance’s PORT number.
If the two databases are located on the same DB instance, then you need to use the database name to gain access to the database.
Hope this helps :)
Diana
 
Share this answer
 
SQL
SELECT * FROM databaseA.schema.table
SELECT * FROM databaseB.schema.table
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900