Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > .NET > Other .NET > ADO.NET
Password Reminder
Register
| FAQ | Members List | Search | Today's Posts | Mark Forums Read
ADO.NET For discussion about ADO.NET.  Topics such as question regarding the System.Data namespace are appropriate.  Questions specific to a particular application should be posted in a forum specific to the application .
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ADO.NET section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old February 25th, 2005, 12:21 AM
Authorized User
 
Join Date: Feb 2005
Location: hyderabad, Andhara Pradesh, India.
Posts: 91
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to ashokparchuri Send a message via Yahoo to ashokparchuri
Default global.asax

hello,
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
Reply With Quote
  #2 (permalink)  
Old February 25th, 2005, 08:40 AM
Authorized User
 
Join Date: Jan 2005
Location: havana, , Cuba.
Posts: 35
Thanks: 0
Thanked 0 Times in 0 Posts
Default

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

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

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...
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to declare the global variable in global.asax? calyn_gately ASP.NET 3.5 Basics 0 August 6th, 2008 08:06 PM
Global.asax error sivaganesh_naidu ASP.NET 2.0 Professional 2 August 24th, 2006 10:53 AM
Error with Global.asax madkaikar_ashish .NET Web Services 3 August 7th, 2006 12:03 AM
what is global.asax? gaurav_jain2403 General .NET 1 February 3rd, 2006 02:40 PM



All times are GMT -4. The time now is 06:33 AM.


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