Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Closing the connection

Reply
Thread Tools

Closing the connection

 
 
Evan
Guest
Posts: n/a
 
      10-18-2004
Hi guys... I am developing an application and need some advice while
the application is still in its infancy.

1. Set Conn = Server.CreateObject("ADODB.Connection")
2. Conn = "PROVIDER=Microsoft.Jet.OLEDB.4.0;DATA SOURCE=" &
Server.MapPath("documents.mdb")
3. Set rs = Server.CreateObject("ADODB.Recordset")
4. SQL="SELECT * FROM users"
6. rs.close
7. set rs=nothing

My question is... is this the most efficient way to connect to the DB
and shouldnt I be closing my Conn... cause when I try the system says
that the obj doesnt exist...

Any advice would be appreciated !

Evan
 
Reply With Quote
 
 
 
 
Lucas Tam
Guest
Posts: n/a
 
      10-18-2004
http://www.velocityreviews.com/forums/(E-Mail Removed) (Evan) wrote in
news:(E-Mail Removed) om:

> 1. Set Conn = Server.CreateObject("ADODB.Connection")
> 2. Conn = "PROVIDER=Microsoft.Jet.OLEDB.4.0;DATA SOURCE=" &
> Server.MapPath("documents.mdb")
> 3. Set rs = Server.CreateObject("ADODB.Recordset")
> 4. SQL="SELECT * FROM users"
> 6. rs.close
> 7. set rs=nothing
>
> My question is... is this the most efficient way to connect to the DB
> and shouldnt I be closing my Conn... cause when I try the system says
> that the obj doesnt exist...


Wrong group... you should be asking this in a ASP or VB6 group : )

--
Lucas Tam ((E-Mail Removed))
Please delete "REMOVE" from the e-mail address when replying.
http://members.ebay.com/aboutme/coolspot18/
 
Reply With Quote
 
 
 
 
Norman Yuan
Guest
Posts: n/a
 
      10-18-2004
Wrong NG, but.. see comment in line

"Evan" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed) om...
> Hi guys... I am developing an application and need some advice while
> the application is still in its infancy.
>
> 1. Set Conn = Server.CreateObject("ADODB.Connection")
> 2. Conn = "PROVIDER=Microsoft.Jet.OLEDB.4.0;DATA SOURCE=" &
> Server.MapPath("documents.mdb")


'above line should be
Conn.ConnectionString="Provider......."

''Then yo need to Open the connection
Conn.Open

> 3. Set rs = Server.CreateObject("ADODB.Recordset")
> 4. SQL="SELECT * FROM users"


''you did not open the recordset, so, you cannot close it.. you need to
add:

rs.Open SQL, Conn

''then do something here and then close it and then close the connection

> 6. rs.close
> 7. set rs=nothing


Conn.Close

>
> My question is... is this the most efficient way to connect to the DB
> and shouldnt I be closing my Conn... cause when I try the system says
> that the obj doesnt exist...
>
> Any advice would be appreciated !
>
> Evan



 
Reply With Quote
 
 
 
Reply

Thread Tools

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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Closing popup window when closing parent window? =?Utf-8?B?Vk1J?= ASP .Net 3 02-15-2007 08:29 AM
ERROR CLOSING CONNECTION: mysql connection close johnny Python 1 12-08-2006 09:42 PM
Connection timeout (connection closing after 100 sec ) shmuel witman ASP .Net Web Services 2 12-06-2005 10:59 AM
Closing the doors 15 minutes before closing. doofus Computer Support 12 06-11-2005 08:20 AM
Closing child window WITHOUT closing parent thomas Javascript 0 10-23-2003 04:10 PM



Advertisments