p2p.wrox.com Forums

Need to download code?

View our list of code downloads.


  Return to Index  

proasp_codeclinic thread: Problems using objRS.MovePrevious


Message #1 by thekman@w... on Fri, 9 Mar 2001 22:54:44
By default, you have opened a Forward Scrolling only recordset. You can only
issue these commands on
this type of recordset: MoveFirst, MoveNext, and MoveLast: Study the example
below for insight.

The Const declarations can be obtained from the adovbs.inc include file.
There several ways to reference
this file and its declarations. One is to include the file at the top of
your ASP page:
<!-- #include file="adovbs.inc" -->

Another is to modify the global.asa file to include this statement:
<SCRIPT LANGUAGE=VBSCRIPT RUNAT=SERVER>
<!-- METADATA TYPE="TypeLib" FILE="C:\Program Files\Common
Files\system\ado\msado15.dll" -->

And lastly to do as I have done, simply declare the consts within the page.
Each method has its advantages
and disadvantages.

'-----Cursor Enum Values----
Const adOpenForwardOnly = 0
Const adOpenKeyset = 1
Const adOpenDynamic = 2
Const adOpenStatic = 3

'---- LockTypeEnum Values ----
Const adLockReadOnly = 1
Const adLockPessimistic = 2
Const adLockOptimistic = 3
Const adLockBatchOptimistic = 4

'---- CursorLocationEnum Values ----
Const adUseNone = 1
Const adUseServer = 2
Const adUseClient = 3
Const adUseClientBatch = 3

'---- CommandTypeEnum Values ----
Const adCmdUnknown = &H0008
Const adCmdText = &H0001
Const adCmdTable = &H0002
Const adCmdStoredProc = &H0004

set rsRecordSet = Server.CreateObject("ADODB.Recordset")
rsRecordSet.Open strSQL, cnConn, adOpenForwardOnly, adLockReadOnly,
adCmdText

HTH,
Dallas Martin



----- Original Message -----
From: <thekman@w...>
To: "Code Clinic" <proasp_codeclinic@p...>
Sent: Friday, March 09, 2001 10:54 PM
Subject: Problems using objRS.MovePrevious


> For some reason, I'm not able to use the .moveprevious command in this
> connection string. I'm not too familiar with this sort of connection(OLE,
> OLEDB, I get them confused. :)
> Anyway...if someone could please help me fix this bit of code so I can use
> the .moveprevious command, I'd really appreciate it. Thanks!
>
> <%
> uploadID = Request.Querystring("uploadID")
>
> myDSN = "DSN=Upload;uid=AspConnect;password=aspconn"
> set connRE = Server.CreateObject ("ADODB.Connection")
> set objRS = Server.CreateObject ("ADODB.Recordset")
> connRE.Open myDSN
>
> strSQL = "Select * from textUpload where uploadID='" & uploadID & "'"
> objRS.Open strSQL, connRE
>
> title = objRS("title")
> briefDesc = objRS("briefDesc")
> fullStory = objRS("fullStory")
> posterName = objRS("userName")
> uploadDate = objRS("todayDate")
>
> objRS.MoveNext
> If objRS.EOF Then
> nextStory = "Nil"
> End if
> If not objRS.EOF Then
> nextStory = objRS("uploadID")
> End If
>
> objRS.MovePrevious
> objRS.MovePrevious
>
> If objRS.BOF Then
> previousStory = "Nil"
> End If
> If Not objRS.BOF Then
> previousStory = objRS("uploadID")
> End If
> %>



  Return to Index