Click to See Complete Forum and Search --> : Access and recordlocking
Paul Dionne
03-27-2000, 01:32 PM
I have an Access database that I open a connection to via VBScript:
strProvider="DRIVER=Microsoft Access Driver (*.mdb); DBQ=" &
Server.MapPath("ScoresDatabase.mdb") & ";"
' create the object on the server
set cn = Server.CreateObject("ADODB.Connection")
cn.Open strProvider
Set rs = Server.CreateObject("ADODB.recordset")
rs.Open strQuery, cn, 1, 3
Set Session("SimpleRS") = rs
Now, when the user exits the site, how do I destroy the connection so that
it frees up the locks on my database?
Paul Dionne
Kris Eiben
03-27-2000, 02:18 PM
You really, really don't want to put a recordset into a session variable.
It's much more efficient to create & destroy the connection and recordset on
every page, counter-intuitive though that might be. With the method you've
described, you've got recordsets open when you don't need them (for example,
while the user reads the screen). Create and destroy on every page, and let
connection pooling work for you.
Kris
Paul Dionne wrote in message <38df9859@news.devx.com>...
>I have an Access database that I open a connection to via VBScript:
>
> strProvider="DRIVER=Microsoft Access Driver (*.mdb); DBQ=" &
>Server.MapPath("ScoresDatabase.mdb") & ";"
> ' create the object on the server
> set cn = Server.CreateObject("ADODB.Connection")
> cn.Open strProvider
> Set rs = Server.CreateObject("ADODB.recordset")
> rs.Open strQuery, cn, 1, 3
> Set Session("SimpleRS") = rs
>
>Now, when the user exits the site, how do I destroy the connection so that
>it frees up the locks on my database?
>Paul Dionne
Joel Hudon
06-29-2000, 11:21 AM
test excuse me
Paul Dionne <P-IHATESPAM-Dionne@Kreative.net> wrote in message
news:38df9859@news.devx.com...
> I have an Access database that I open a connection to via VBScript:
>
> strProvider="DRIVER=Microsoft Access Driver (*.mdb); DBQ=" &
> Server.MapPath("ScoresDatabase.mdb") & ";"
> ' create the object on the server
> set cn = Server.CreateObject("ADODB.Connection")
> cn.Open strProvider
> Set rs = Server.CreateObject("ADODB.recordset")
> rs.Open strQuery, cn, 1, 3
> Set Session("SimpleRS") = rs
>
> Now, when the user exits the site, how do I destroy the connection so that
> it frees up the locks on my database?
>
> Paul Dionne
>
>
Don Wolthuis
06-29-2000, 12:48 PM
Simply set the variables to nothing
SET rs = nothing
SET cn = nothing
Make sure to do this at the end of your page.
Don
"Joel Hudon" <joel.hudon@progisys.com> wrote:
>test excuse me
>Paul Dionne <P-IHATESPAM-Dionne@Kreative.net> wrote in message
>news:38df9859@news.devx.com...
>> I have an Access database that I open a connection to via VBScript:
>>
>> strProvider="DRIVER=Microsoft Access Driver (*.mdb); DBQ=" &
>> Server.MapPath("ScoresDatabase.mdb") & ";"
>> ' create the object on the server
>> set cn = Server.CreateObject("ADODB.Connection")
>> cn.Open strProvider
>> Set rs = Server.CreateObject("ADODB.recordset")
>> rs.Open strQuery, cn, 1, 3
>> Set Session("SimpleRS") = rs
>>
>> Now, when the user exits the site, how do I destroy the connection so
that
>> it frees up the locks on my database?
>>
>> Paul Dionne
>>
>>
>
>
devx.com
Copyright WebMediaBrands Inc. All Rights Reserved