Click here to Skip to main content
15,948,339 members
Please Sign up or sign in to vote.
3.50/5 (2 votes)
See more:
how to establish a db connection dynamically using enterprise library without using app config/web config. Please help
dan!sh 30-Dec-10 6:48am    
Can you please describe a bit more?

Hope Dynamic DBConnection[^] will help you.
Share this answer
dear friend u can directly create connection by using..

SqlConnection con=new SqlConnection("connection string ");
SqlCommand cmd=new SqlCommand("select *form mytb",con);
SqlDataReader dr=cmd.ExecuteReader();

by this u can esily create connection on any event and use table..ok
Share this answer
Henry Minute 30-Dec-10 8:50am    
Perhaps you could expand your answer to explain how it uses the Enterprise Library?
mohammadrijwan 31-Dec-10 3:48am    
ya sure dear frnd..
first u need to use
using System.Data.SqlClient if u r using SqlServer..ok
and then on the form load event u can create connection
as i above write..
in the connection string u need to give the

Data Source=myServerAddress;Initial Catalog=myDataBase;User Id=myUsername;Password=myPassword;

write complete code from the above..ok
and use dr

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