|
-
Jun 13th, 2003, 02:26 AM
#1
Thread Starter
Addicted Member
ADO Error [RESOLVED]
When I run this script I get the error: Rowset does not support fetching backward.
This error occurs when I try to use the Rst.MoveLast command but I was under the impression that I could do this if I had opened the record set as "Rst.CursorType = adOpenDynamic" obviously I am doing something wrong here can someone point me in the right direction please.
VB Code:
Dim CN As New ADODB.Connection
Dim Cmd As New ADODB.Command
Dim Rst As New ADODB.Recordset
Dim DeviceCount As Integer
Dim Count As Integer
'Open DB Connection
CN.Open DBPath
Set Rst = New ADODB.Recordset
Rst.CursorType = adOpenDynamic
Rst.Supports (adMovePrevious)
'Prepare the user-defined function statement and execute the command.
Cmd.ActiveConnection = CN
Cmd.CommandText = "SELECT DeviceName, DeviceType, CMACNum, Address, PLCID, NumEvents, StartRead, StopRead FROM SOEWFC_Definitions;"
Set Rst = Cmd.Execute
'Check to see if there are any records in the table
If Rst.EOF = False Then
'get number of rows in Backups table
Rst.MoveLast
DeviceCount = Rst.RecordCount
Rst.MoveFirst
End If
Last edited by mik706; Jun 13th, 2003 at 03:20 AM.
-
Jun 13th, 2003, 03:05 AM
#2
Try:
Rst.CursorType = adOpenKeyset
Pete
No trees were harmed in the making of this post, however a large number of electrons were greatly inconvenienced.
-
Jun 13th, 2003, 03:09 AM
#3
Thread Starter
Addicted Member
Tried that but i still get the same error.
-
Jun 13th, 2003, 03:15 AM
#4
OK. Try this:
VB Code:
Set Rst = New ADODB.Recordset
Dim sql As String
'Prepare the user-defined function statement and execute the command.
sql = "SELECT DeviceName, DeviceType, CMACNum, Address, PLCID, NumEvents, StartRead, StopRead FROM SOEWFC_Definitions;"
Rst.Open sql, CN, adOpenKeyset
Pete
No trees were harmed in the making of this post, however a large number of electrons were greatly inconvenienced.
-
Jun 13th, 2003, 03:20 AM
#5
Thread Starter
Addicted Member
Cheers pnish seams to be working OK now. Thanks for the help!!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|