Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 1.0 and 1.1 > ASP.NET 1.0 and 1.1 Professional
Password Reminder
Register
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
ASP.NET 1.0 and 1.1 Professional For advanced ASP.NET 1.x coders. Beginning-level questions will be redirected to other forums. NOT for "classic" ASP 3 or the newer ASP.NET 2.0 and 3.5
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 1.0 and 1.1 Professional 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
 
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old May 31st, 2004, 03:07 PM
Registered User
 
Join Date: May 2004
Location: , , .
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default How to create OledbConnection Global.asax

Hi, any know How to create OledbConnection instance?

This is my code:

void Application_Start(object sender, EventArgs e) {
OleDbConnection Application["ConnDB"] = new OleDbConnection ConfigurationSettings.AppSettings["strConnDB"]);
Application["ConnDB"].Open();
}

Thanks for a lot.

  #2 (permalink)  
Old May 31st, 2004, 04:19 PM
Friend of Wrox
 
Join Date: Jun 2003
Location: Copenhagen, , Denmark.
Posts: 440
Thanks: 0
Thanked 0 Times in 0 Posts
Default

OK, first of all you only have to post the question one time.

I do not know if you can do what you are trying, however I noticed a missing parenthesis...
Code:
new OleDbConnection(ConfigurationSettings.AppSettings["strConnDB"]);
What are you trying to accomplish by opening the connection here? It looks kind of odd to me, since I have learned that you should open the connection when needed.

Hope it helps :)

Jacob.
  #3 (permalink)  
Old May 31st, 2004, 08:22 PM
Friend of Wrox
 
Join Date: Jun 2003
Location: Harrisburg, PA, USA.
Posts: 1,998
Thanks: 0
Thanked 3 Times in 3 Posts
Default

You can create an object, and assign it to the application parameter:

OleDbConnection cn = New OleDbConnection(ConfigurationSettings.AppSettings["strConnDB"]);
Application["ConnDB"] = cn;

Then open and close the connection when needed.

Brian
 


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
what is global.asax? gaurav_jain2403 General .NET 1 February 3rd, 2006 02:40 PM
global.asax ashokparchuri ADO.NET 1 February 25th, 2005 08:40 AM



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


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