This topic is locked
[SOLVED]

 error '80040e24'

7/5/2005 4:13:44 AM
ASPRunnerPro General questions
author

Hi there,
I'm evaluating ASPRunnerPro, and so far it looks great. However I'm getting this error message when I load the page:
Microsoft OLE DB Provider for ODBC Drivers error '80040e24'
Rowset does not support fetching backward.
/Jobs_list.asp, line 598
Line 598 is the end of the setupRs function (below), and if I comment out the line before the endIf (as shown), then the page loads and works in all respects except that there is no page navigation, and the page numbers and record count in the top right are all zero.
I'm connecting to a MYOB database through an ODBC DSN.
I'm now out of my depth. Any help will be most appreciated.
Julien

function setupRs(strConnection,strSQL,nPageSize)
Err.Clear
Set setupRs = server.CreateObject ("ADODB.Recordset")

'setupRs.CursorLocation = 3
set dbConnection = server.CreateObject ("ADODB.Connection")

dbConnection.ConnectionString = strConnection
On Error Resume Next

dbConnection.Open

Call ReportError
LogInfo(strSQL)

setupRs.open strSQL,dbConnection, 1, 2

Call ReportError

On Error Goto 0

 

' Pagination:

if NOT setupRs.EOF then

 maxRecords = cdbl(setupRs.RecordCount)

 maxpages = maxRecords \ nPageSize

 if maxRecords mod nPageSize > 0 then maxpages =maxpages +1
 if cdbl(mypage) > cdbl(maxpages) then mypage = maxpages

 maxrecs=nPageSize



 setupRs.MoveFirst

 'setupRs.Move nPageSize * (mypage-1)

End IF
end function
admin 7/5/2005

Julien,
it appears that MYOB ODBC driver is not quite ODBC compliant.
Here is what you can try to fix it.
Replace

setupRs.Move nPageSize * (mypage-1)


with

if nPageSize (mypage-1) > 0 then setupRs.Move nPageSize (mypage-1)


If this helps I will add this fix to ASPRunner templates.

500279 7/5/2005

Thanks for your prompt reply. This has fixed the problem of the page not loading, but there are still no page navigation links. The page info at the top of the page says:
Details found: -1

Page 0 of 0
It seems to be not counting the records correctly, however there are no other error messages.
Cheers

Julien

admin 7/6/2005

Julien,
please try the following. Here is setupRS function that should work fine with MYOB database. Try to replace existing one and let me know if it works.

function setupRs(strConnection,strSQL,nPageSize)

Err.Clear
Set setupRs = server.CreateObject ("ADODB.Recordset")
if GetDatabaseType()=DATABASE_MySQL or GetDatabaseType()=DATABASE_Oracle then setupRs.CursorLocation = 3
set dbConnection = server.CreateObject ("ADODB.Connection")

dbConnection.ConnectionString = strConnection
On Error Resume Next

dbConnection.Open

Call ReportError
LogInfo(strSQL)

setupRs.open strSQL,dbConnection, 1, 2

Call ReportError

On Error Goto 0

 

' Pagination:

if NOT setupRs.EOF then
  Set rsCount = server.CreateObject ("ADODB.Recordset")

  n = InStr(lcase(strSQL), " from ")

  if n>1 then

  response.write "select count() " & Mid(strSQL, n)

  rsCount.open "select count(
) " & Mid(strSQL, n),dbConnection, 1, 2

  maxRecords = rsCount(0)

  rsCount.Close : set rsCount = Nothing

  end if

 

  ' maxRecords = cdbl(setupRs.RecordCount)

  maxpages = maxRecords \ nPageSize

  if maxRecords mod nPageSize > 0 then maxpages =maxpages +1
  if cdbl(mypage) > cdbl(maxpages) then mypage = maxpages

  maxrecs=nPageSize
  setupRs.MoveFirst

  if nPageSize (mypage-1) > 0 then setupRs.Move nPageSize (mypage-1)

End IF
end function

500280 7/6/2005

Sergey,
Thanks, it almost works. There are now page navigation links at the bottom of the page, but any page after page 1 displays "No records found".
Thanks for your efforts
Julien

admin 7/12/2005

Julien,
not sure what else needs to be done. Probably you can export data to MS Access or SQL Server and run ASPRunnerPro against it.