|
 |
asp_databases thread: adOpenDynamic!!!! how do I go up an Access dataBase
Message #1 by Andrew Scott <Andrew@c...> on Wed, 18 Apr 2001 19:51:43 +0100
|
|
Hi all
I am having REAL trouble trying to get my ASP to to move up an Access
database... I have discovered that I should open it 'Dynamicaly' but I can't
get it to work...
Here's my code...
<%@ LANGUAGE="VBSCRIPT"%>
<!-- #include file="adovbs.inc" -->
<%
Dim dbc
On Error Resume Next
set strConn = NOTHING
set dbc = NOTHING
set dbc = Server.CreateObject("ADODB.Connection")
dbc.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=ACCESSFILE.mdb;"
If Err <> 0 Then
Response.Redirect ("error.asp?var=" & Err & " " & strConn )
End if
sql = "SELECT * " & " FROM Table "
Set rs=dbc.execute(sql)
I WANT TO MOVE TO THE LAST RECORD HERE AND THEN GO BACK THROUGH THE TABLE
rs.close
set rs=nothing
dbc.close
%>
Please Help!!!
Thanks in advance :)
AndyScott
Message #2 by "Thor Burfine" <tburfine@k...> on Wed, 18 Apr 2001 23:35:55
|
|
if not rs.eof then 'check if there are any records
rs.movelast 'move to the last record
rs.movefirst 'move to the first record
end if
> Hi all
>
> I am having REAL trouble trying to get my ASP to to move up an Access
> database... I have discovered that I should open it 'Dynamicaly' but I
can't
> get it to work...
>
> Here's my code...
>
> <%@ LANGUAGE="VBSCRIPT"%>
>
> <!-- #include file="adovbs.inc" -->
> <%
>
> Dim dbc
> On Error Resume Next
> set strConn = NOTHING
> set dbc = NOTHING
>
> set dbc = Server.CreateObject("ADODB.Connection")
> dbc.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=ACCESSFILE.mdb;"
>
> If Err <> 0 Then
> Response.Redirect ("error.asp?var=" & Err & " " & strConn )
> End if
>
> sql = "SELECT * " & " FROM Table "
> Set rs=dbc.execute(sql)
>
>
> I WANT TO MOVE TO THE LAST RECORD HERE AND THEN GO BACK THROUGH THE TABLE
>
>
> rs.close
> set rs=nothing
> dbc.close
> %>
>
> Please Help!!!
>
> Thanks in advance :)
> AndyScott
>
Message #3 by "Daniel O'Dorisio" <dodorisio@h...> on Wed, 18 Apr 2001 18:22:46 -0400
|
|
maybe you are looking for something like: rs.movelast??
Daniel
-----Original Message-----
From: Andrew Scott [mailto:Andrew@c...]
Sent: Wednesday, April 18, 2001 6:30 PM
To: ASP Databases
Subject: [asp_databases] adOpenDynamic!!!! how do I go up an Access
dataBase
Hi all
I am having REAL trouble trying to get my ASP to to move up an Access
database... I have discovered that I should open it 'Dynamicaly' but I can't
get it to work...
Here's my code...
<%@ LANGUAGE="VBSCRIPT"%>
<!-- #include file="adovbs.inc" -->
<%
Dim dbc
On Error Resume Next
set strConn = NOTHING
set dbc = NOTHING
set dbc = Server.CreateObject("ADODB.Connection")
dbc.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=ACCESSFILE.mdb;"
If Err <> 0 Then
Response.Redirect ("error.asp?var=" & Err & " " & strConn )
End if
sql = "SELECT * " & " FROM Table "
Set rs=dbc.execute(sql)
I WANT TO MOVE TO THE LAST RECORD HERE AND THEN GO BACK THROUGH THE TABLE
rs.close
set rs=nothing
dbc.close
%>
Please Help!!!
Thanks in advance :)
AndyScott
Message #4 by "Dallas Martin" <dmartin@z...> on Wed, 18 Apr 2001 19:45:13 -0400
|
|
The recordset type that you are opening is a Forward Scrolling recordset.
This means that you can issue these commands: rs.MoveFirst, rs.MoveNext
and rs.MoveLast. You can't use rs.MovePrevious
You need to do this:
set rs = Server.CreateObject("ADODB.Recordset")
rs.CursorType = adOpenStatic (or adOpenKeySet or adOpenDynamic
rs.CursorLocation = adUseClient (or adUseServer)
rs.LockType = adLockReadOnly ( or adLockPessimistic or adLockOptimistic or
adLockBatchOptimistic)
rs.ActiveConnection = dbc
rs.Open strSQL
Check out any of the many ASP sites for more information:
www.adOpenStatic.com
www.Asp101.com
www.AspFree.com
Dallas
----- Original Message -----
From: "Andrew Scott" <Andrew@c...>
To: "ASP Databases" <asp_databases@p...>
Sent: Wednesday, April 18, 2001 6:30 PM
Subject: [asp_databases] adOpenDynamic!!!! how do I go up an Access dataBase
> Hi all
>
> I am having REAL trouble trying to get my ASP to to move up an Access
> database... I have discovered that I should open it 'Dynamicaly' but I
can't
> get it to work...
>
> Here's my code...
>
> <%@ LANGUAGE="VBSCRIPT"%>
>
> <!-- #include file="adovbs.inc" -->
> <%
>
> Dim dbc
> On Error Resume Next
> set strConn = NOTHING
> set dbc = NOTHING
>
> set dbc = Server.CreateObject("ADODB.Connection")
> dbc.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=ACCESSFILE.mdb;"
>
> If Err <> 0 Then
> Response.Redirect ("error.asp?var=" & Err & " " & strConn )
> End if
>
> sql = "SELECT * " & " FROM Table "
> Set rs=dbc.execute(sql)
>
>
> I WANT TO MOVE TO THE LAST RECORD HERE AND THEN GO BACK THROUGH THE TABLE
>
>
> rs.close
> set rs=nothing
> dbc.close
> %>
>
> Please Help!!!
>
> Thanks in advance :)
> AndyScott
Message #5 by Andrew Scott <Andrew@c...> on Thu, 19 Apr 2001 12:55:47 +0100
|
|
That's Got it!!! thanks alot...
-----Original Message-----
From: Dallas Martin [mailto:dmartin@z...]
Sent: 19 April 2001 00:45
To: ASP Databases
Subject: [asp_databases] Re: adOpenDynamic!!!! how do I go up an Access
dataBase
The recordset type that you are opening is a Forward Scrolling recordset.
This means that you can issue these commands: rs.MoveFirst, rs.MoveNext
and rs.MoveLast. You can't use rs.MovePrevious
You need to do this:
set rs = Server.CreateObject("ADODB.Recordset")
rs.CursorType = adOpenStatic (or adOpenKeySet or adOpenDynamic
rs.CursorLocation = adUseClient (or adUseServer)
rs.LockType = adLockReadOnly ( or adLockPessimistic or adLockOptimistic or
adLockBatchOptimistic)
rs.ActiveConnection = dbc
rs.Open strSQL
Check out any of the many ASP sites for more information:
www.adOpenStatic.com
www.Asp101.com
www.AspFree.com
Dallas
----- Original Message -----
From: "Andrew Scott" <Andrew@c...>
To: "ASP Databases" <asp_databases@p...>
Sent: Wednesday, April 18, 2001 6:30 PM
Subject: [asp_databases] adOpenDynamic!!!! how do I go up an Access dataBase
> Hi all
>
> I am having REAL trouble trying to get my ASP to to move up an Access
> database... I have discovered that I should open it 'Dynamicaly' but I
can't
> get it to work...
>
> Here's my code...
>
> <%@ LANGUAGE="VBSCRIPT"%>
>
> <!-- #include file="adovbs.inc" -->
> <%
>
> Dim dbc
> On Error Resume Next
> set strConn = NOTHING
> set dbc = NOTHING
>
> set dbc = Server.CreateObject("ADODB.Connection")
> dbc.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=ACCESSFILE.mdb;"
>
> If Err <> 0 Then
> Response.Redirect ("error.asp?var=" & Err & " " & strConn )
> End if
>
> sql = "SELECT * " & " FROM Table "
> Set rs=dbc.execute(sql)
>
>
> I WANT TO MOVE TO THE LAST RECORD HERE AND THEN GO BACK THROUGH THE TABLE
>
>
> rs.close
> set rs=nothing
> dbc.close
> %>
>
> Please Help!!!
>
> Thanks in advance :)
> AndyScott
Message #6 by "Tomm Matthis" <matthis@b...> on Fri, 20 Apr 2001 13:58:12 -0400
|
|
You need to open the recordset via rs.OPEN and not a connection.execute
command. When you use the connection method you only get a forwardONly
cursor... when you use the rs.Open, you can specify the type of cursor
which supports moving back and forth in the recordset.
Tomm
> -----Original Message-----
> From: Andrew Scott [mailto:Andrew@c...]
> Sent: Wednesday, April 18, 2001 6:30 PM
> To: ASP Databases
> Subject: [asp_databases] adOpenDynamic!!!! how do I go up an Access
> dataBase
>
>
> Hi all
>
> I am having REAL trouble trying to get my ASP to to move up an Access
> database... I have discovered that I should open it 'Dynamicaly'
> but I can't
> get it to work...
>
> Here's my code...
>
> <%@ LANGUAGE=3D"VBSCRIPT"%>
>
> <!-- #include file=3D"adovbs.inc" -->
> <%
>
> Dim dbc
> On Error Resume Next
> set strConn =3D NOTHING
> set dbc =3D NOTHING
>
> set dbc =3D Server.CreateObject("ADODB.Connection")
> dbc.Open "Provider=3DMicrosoft.Jet.OLEDB.4.0;Data
Source=3DACCESSFILE.mdb;"
>
> If Err <> 0 Then
> Response.Redirect ("error.asp?var=3D" & Err & " " & strConn )
> End if
>
> sql =3D "SELECT * " & " FROM Table "
> Set rs=3Ddbc.execute(sql)
>
>
> I WANT TO MOVE TO THE LAST RECORD HERE AND THEN GO BACK THROUGH THE
TABLE
>
>
> rs.close
> set rs=3Dnothing
> dbc.close
> %>
>
> Please Help!!!
>
> Thanks in advance :)
> AndyScott
>
>
> ---
> SoftArtisans helps developers build robust, scalable Web applications!
> Excel Web reports, charts:
http://www.softartisans.com/excelwriter.html
> File uploads: http://www.softartisans.com/saf.html
> Transactional file management: http://www.softartisans.com/saf1.html
> Scalability: http://www.softartisans.com/saxsession.html
> ASPstudio value pack: http://www.softartisans.com/aspstudiosuite.html
> $subst('Email.Unsub')
>
>
Message #7 by "Ken Schaefer" <ken@a...> on Mon, 23 Apr 2001 18:31:13 +1000
|
|
Just FYI
You can only get adOpenForwardOnly and adOpenKeyset cursors with the Jet
OLEDB provider and adUseServer cursor location. Attempting anything else
will get you either of the previous two depending on the locktype you
choose.
You get adOpenStatic cursors with adUseClient location.
Cheers
Ken
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
----- Original Message -----
From: "Dallas Martin" <dmartin@z...>
To: "ASP Databases" <asp_databases@p...>
Sent: Thursday, April 19, 2001 9:45 AM
Subject: [asp_databases] Re: adOpenDynamic!!!! how do I go up an Access
dataBase
: The recordset type that you are opening is a Forward Scrolling recordset.
: This means that you can issue these commands: rs.MoveFirst, rs.MoveNext
: and rs.MoveLast. You can't use rs.MovePrevious
:
: You need to do this:
:
: set rs = Server.CreateObject("ADODB.Recordset")
: rs.CursorType = adOpenStatic (or adOpenKeySet or adOpenDynamic
: rs.CursorLocation = adUseClient (or adUseServer)
: rs.LockType = adLockReadOnly ( or adLockPessimistic or adLockOptimistic or
: adLockBatchOptimistic)
: rs.ActiveConnection = dbc
: rs.Open strSQL
:
: Check out any of the many ASP sites for more information:
:
: www.adOpenStatic.com
:
: www.Asp101.com
:
: www.AspFree.com
:
: Dallas
:
:
: ----- Original Message -----
: From: "Andrew Scott" <Andrew@c...>
: To: "ASP Databases" <asp_databases@p...>
: Sent: Wednesday, April 18, 2001 6:30 PM
: Subject: [asp_databases] adOpenDynamic!!!! how do I go up an Access
dataBase
:
:
: > Hi all
: >
: > I am having REAL trouble trying to get my ASP to to move up an Access
: > database... I have discovered that I should open it 'Dynamicaly' but I
: can't
: > get it to work...
: >
: > Here's my code...
: >
: > <%@ LANGUAGE="VBSCRIPT"%>
: >
: > <!-- #include file="adovbs.inc" -->
: > <%
: >
: > Dim dbc
: > On Error Resume Next
: > set strConn = NOTHING
: > set dbc = NOTHING
: >
: > set dbc = Server.CreateObject("ADODB.Connection")
: > dbc.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=ACCESSFILE.mdb;"
: >
: > If Err <> 0 Then
: > Response.Redirect ("error.asp?var=" & Err & " " & strConn )
: > End if
: >
: > sql = "SELECT * " & " FROM Table "
: > Set rs=dbc.execute(sql)
: >
: >
: > I WANT TO MOVE TO THE LAST RECORD HERE AND THEN GO BACK THROUGH THE
TABLE
: >
: >
: > rs.close
: > set rs=nothing
: > dbc.close
: > %>
: >
: > Please Help!!!
: >
: > Thanks in advance :)
: > AndyScott
|
|
 |