Wrox Programmer Forums
|
ASP.NET 1.1 As of 10/6/2005, this forum is locked as part of the reorganization described here: http://p2p.wrox.com/topic.asp?TOPIC_ID=35394. No posts have been deleted. Open ongoing discussions from the last week have been moved to either ASP.NET 1.0 and 1.1 Beginners http://p2p.wrox.com/asp-net-1-0-1-1-basics-60/ or ASP.NET 1.0 and 1.1 Professional. http://p2p.wrox.com/forum.asp?FORUM_ID=50. See my sticky post inside for more.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 1.1 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old August 31st, 2004, 06:46 AM
Registered User
 
Join Date: Aug 2004
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to sri_karthik
Default global.asax in ASP.NET 1.1

I want to write sqlconnection code in global.asax (application on start) so that I need not to repeat the code again and again in the web pages. Please try to help me with code example. Thank U.

With Regards,
S. Karthikeyan
 
Old August 31st, 2004, 07:20 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 1,110
Thanks: 0
Thanked 3 Times in 3 Posts
Default

What do you need help with? Connecting to a database or coding in the global.asax?

 
Old August 31st, 2004, 08:31 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 1,101
Thanks: 0
Thanked 2 Times in 2 Posts
Default

I shoudl note- Making a global data connection on the Application start is a VERY BAD idea.


Hal Levy
Web Developer, PDI Inc.

NOT a Wiley/Wrox Employee
 
Old September 1st, 2004, 08:09 AM
Registered User
 
Join Date: Aug 2004
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default

You should do it in the web.config file in your root directory... add a key/valuepair with the connection string and then reference it. Not got the code to do that myself as i choose to write a connection in a user control and then just reference that.

use this string if its access

dim theconnection as string = "provider=microsoft.jet.oledb.4.0;data source=" & server.mappath("thedatabasefile.mdb")

i find that a much more reliable way of connecting up to a database...







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
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





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