Wrox Programmer Forums
Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 1.0 and 1.1 > ASP.NET 1.0 and 1.1 Basics
|
ASP.NET 1.0 and 1.1 Basics ASP.NET discussion for users new to coding in ASP.NET 1.0 or 1.1. NOT for the older "classic" ASP 3 or the newer ASP.NET 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 1.0 and 1.1 Basics 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 January 16th, 2006, 03:35 AM
Authorized User
 
Join Date: Jan 2006
Posts: 18
Thanks: 0
Thanked 0 Times in 0 Posts
Default declare connectionobject in application_Start met

I write this code in application_Start method of global.asax.vb file :

Public cnConnection As SqlConnection

cnConnection = New SqlConnection("server=(local); database=test; User ID=sa; Password=sa")

cnConnection.Open()

Now I want to use this cnConnection in my Login page and
In Login page i write this code.

Dim strSQL As String = "Select * from user_detail"
Dim cnCommand1 As SqlCommand = New SqlCommand(strSQL, cnConnection)


It gives me a error message i.e.
C:\Inetpub\wwwroot\Login\frmLogin.aspx.vb(86): Reference to a non-shared member requires an object reference.




 
Old January 16th, 2006, 05:14 PM
Authorized User
 
Join Date: Jul 2004
Posts: 16
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to Mayur52o
Default

Try using
public shared cnConnection as sqlConnection






Similar Threads
Thread Thread Starter Forum Replies Last Post
Ajax change textbox bgcolor after Criteria met mkthompson Ajax 1 July 28th, 2008 08:56 AM
declare My ajkumar Visual Basic 2005 Basics 0 April 18th, 2007 05:24 AM
how and when does Sub application_start start? kenn_rosie ASP.NET 1.0 and 1.1 Basics 0 February 21st, 2006 10:08 PM
Loop through records- stop if certain value met SoC Classic ASP Basics 2 July 28th, 2005 08:22 PM
About Crystal Report's Viewer.CloseView(Index) Met svgharmode Crystal Reports 0 June 1st, 2004 12:06 AM





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