How to store "connection string" in global.asax file and web.config file using c#?
-
- How to store "connection string" in global.asax file and web.config file using c#? 2) How to get that "connection string" from web.config file and global.asax file to My web application? 3)Where i have to call that connection string on My web application and how i call to that connection from My web application..?
CheeN
-
- How to store "connection string" in global.asax file and web.config file using c#? 2) How to get that "connection string" from web.config file and global.asax file to My web application? 3)Where i have to call that connection string on My web application and how i call to that connection from My web application..?
CheeN
Add the following line in the configuration tag of your web config file Reading it _aseConn.ConnectionString = ConfigurationManager.ConnectionStrings["Name"].ToString(); If you want peace prepare for war...
-
Add the following line in the configuration tag of your web config file Reading it _aseConn.ConnectionString = ConfigurationManager.ConnectionStrings["Name"].ToString(); If you want peace prepare for war...
-
can u post again with how i read it from my web application and how i open that connection @ several times..? thanks alot...
CheeN
Hi, u can add the connection strings in web.config in appsettings tag. <appSettings> <add key="constr" value="server=10.40.21.8;uid=sa;pwd=password;Database=dbname;"></add> </appSettings> Calling this connection string in .cs file SqlConnection dbConn; String ConnectionString = System.Configuration.ConfigurationManager.AppSettings["constr"]; dbConn=new SqlConnection(ConnectionString); dbConn.Open();
Sutheesh Ramachandran Cybernet Software Systems, T Nagar, Chennai 17.