Click here to Skip to main content
15,907,328 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
See more:
pls help.......
i want to use two different database in my asp.net project. means for some pages i want to use db.Test1 and for some pages i want to use db.Test2. how can use both database connection in one project.
thanks in advance...
Posted

1 solution

Dear Friend,

What you can do here is that you can define two different variables for making connection. Set the value of database variable and make connection from it.

The moment you want to switch the connection then you can set the database variable to other database and make other connection while disconnecting the previous connection.

It totally depends on your choice to have multiple database connections open but for that you have to make two different classes from database connectivity else only one class will do.

I hope you understand what i am trying to say.
 
Share this answer
 
Comments
dA.d 21-Feb-12 23:04pm    
how to give two database connections in web.config file.

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