p2p.wrox.com Forums

p2p.wrox.com Forums (http://p2p.wrox.com/index.php)
-   ADO.NET (http://p2p.wrox.com/forumdisplay.php?f=109)
-   -   global.asax (http://p2p.wrox.com/showthread.php?t=26074)

ashokparchuri February 25th, 2005 12:21 AM

can we connect to the database using global.asax file?i want to use the connection i gave in global.asax file rom all the pages in my aplication?please tell me how?in detail...

Thanks in advance-Ashok

ACE2084 February 25th, 2005 08:40 AM

hi, i suggest for your purpose to store the connection string in the wefconfig file like this:

 <add key= "sqlconnection" value= "YOUR CONNECTION STRING HERE"></add>

it is recommended to have one connection per page, so you have to give the connection string property to your connection in some way like this:
SqlConnection myConn = new SqlConnection (ConfigurationSettings.AppSettings["sqlconnection"]);

hope it helps...

All times are GMT -4. The time now is 12:27 AM.

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.