By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
439,972 Members | 1,383 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 439,972 IT Pros & Developers. It's quick & easy.

db connection function

P: n/a
I have a sub named ConnectToDb which has my db connections commands in it.
When I call it from another page that sub routine will not execute and i can't connect to the DB via that sub.
why is it not allowing me to connect?

code:
public sub ConnectToDB()
conn.connectionstring = ConfigurationSettings.AppSettings("DB")
conn.Open
end sub

the code i'm calling it from
sub GetData()
db.ConnectToDB()

'code to call SP's and bind grids

end sub

nothing happens this way, why not?
Nov 18 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
On Thu, 29 Jul 2004 10:57:08 -0700, "IGotYourDotNet" <IG************@discussions.microsoft.com> wrote:
I have a sub named ConnectToDb which has my db connections commands in it.
When I call it from another page that sub routine will not execute and i can't connect to the DB via that sub.
why is it not allowing me to connect?

code:
public sub ConnectToDB()
conn.connectionstring = ConfigurationSettings.AppSettings("DB")
conn.Open
end sub

the code i'm calling it from
sub GetData()
db.ConnectToDB()

'code to call SP's and bind grids

end sub

nothing happens this way, why not?

The main thing that is wrong is that you are not passing the connection object back. To save yourself ALLOT of work - use the microsoft
data block. http://www.microsoft.com/downloads/d...displaylang=en
Bobby Ryzhy
bobby @ domain below
http://weekendtech.net
Nov 18 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.