Bug #27559 Microsoft VBScript runtime (0x800A01FB)
Submitted: 31 Mar 2007 7:29 Modified: 28 May 2013 8:21
Reporter: Grant Harrison Email Updates:
Status: Closed Impact on me:
None 
Category:Connector / ODBC Severity:S2 (Serious)
Version:3.51 OS:Windows (win xp pro sp2)
Assigned to: CPU Architecture:Any

[31 Mar 2007 7:29] Grant Harrison
Description:
Using ASP to ODBC connect with driver 3.51 to the MySQL v 5.0.37 database I get the following error when  the page opens:-

Microsoft VBScript runtime (0x800A01FB)
An exception occurred: 'Open'

If I refresh the page the error resolves and the page displays.

Clearly this is not how it should work. HELP!!

How to repeat:
Use ASP to ODBC connect with driver 3.51 to the MySQL v 5.0.37 database. The following error will occur when  the page opens:-

Microsoft VBScript runtime (0x800A01FB)
An exception occurred: 'Open'

Refresh the page and the error resolves and the page displays.

Clearly this is not how it should work. HELP!!
[31 Mar 2007 9:22] Grant Harrison
// My  Code that fails . . . 

Dim rs_petitioners
Dim rs_petitioners_numRows

Set rs_petitioners = Server.CreateObject("ADODB.Recordset")
rs_petitioners.ActiveConnection = MM_e4imysql_STRING
rs_petitioners.Source = "SELECT first_name, add_town_city FROM e4imysql.tbl_petitioners ORDER BY registration_date DESC"
rs_petitioners.CursorType = 3
rs_petitioners.CursorLocation = 2
rs_petitioners.LockType = 1
rs_petitioners.Open()

rs_petitioners_numRows = 0
%>
<%
Dim Repeat1__numRows
Dim Repeat1__index

Repeat1__numRows = 25
Repeat1__index = 0
rs_petitioners_numRows = rs_petitioners_numRows + Repeat1__numRows
%>

<%
'  *** Recordset Stats, Move To Record, and Go To Record: declare stats variables

Dim rs_petitioners_total
Dim rs_petitioners_first
Dim rs_petitioners_last

' set the record count
rs_petitioners_total = rs_petitioners.RecordCount

' set the number of rows displayed on this page
If (rs_petitioners_numRows < 0) Then
  rs_petitioners_numRows = rs_petitioners_total
Elseif (rs_petitioners_numRows = 0) Then
  rs_petitioners_numRows = 1
End If

' set the first and last displayed record
rs_petitioners_first = 1
rs_petitioners_last  = rs_petitioners_first + rs_petitioners_numRows - 1

' if we have the correct record count, check the other stats
If (rs_petitioners_total <> -1) Then
  If (rs_petitioners_first > rs_petitioners_total) Then
    rs_petitioners_first = rs_petitioners_total
  End If
  If (rs_petitioners_last > rs_petitioners_total) Then
    rs_petitioners_last = rs_petitioners_total
  End If
  If (rs_petitioners_numRows > rs_petitioners_total) Then
    rs_petitioners_numRows = rs_petitioners_total
  End If
End If
%>
<%
' *** Recordset Stats: if we don't know the record count, manually count them

If (rs_petitioners_total = -1) Then

  ' count the total records by iterating through the recordset
  rs_petitioners_total=0
  While (Not rs_petitioners.EOF)
    rs_petitioners_total = rs_petitioners_total + 1
    rs_petitioners.MoveNext
  Wend

  ' reset the cursor to the beginning
  If (rs_petitioners.CursorType > 0) Then
    rs_petitioners.MoveFirst
  Else
    rs_petitioners.Requery
  End If

  ' set the number of rows displayed on this page
  If (rs_petitioners_numRows < 0 Or rs_petitioners_numRows > rs_petitioners_total) Then
    rs_petitioners_numRows = rs_petitioners_total
  End If

  ' set the first and last displayed record
  rs_petitioners_first = 1
  rs_petitioners_last = rs_petitioners_first + rs_petitioners_numRows - 1
  
  If (rs_petitioners_first > rs_petitioners_total) Then
    rs_petitioners_first = rs_petitioners_total
  End If
  If (rs_petitioners_last > rs_petitioners_total) Then
    rs_petitioners_last = rs_petitioners_total
  End If

End If
[6 Apr 2007 8:13] Tonci Grgin
Hi Grant and thanks for your report.

Can you please do the following:
 - I presume rs_petitioners.CursorLocation = 2 means adUseServer. Can you change it to adUseClient (= 3) and test.
 - Can you add comments to your code like this: rs_petitioners.CursorLocation = 2 'adUseServer
 - Can you rewrite test case so that it contains all of DDL statements necessary for execution or write sample that uses, for example, mysql.users table or such that are generally available on every installation.
[6 May 2007 23:00] Bugs System
No feedback was provided for this bug for over a month, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
[7 May 2007 5:46] Tonci Grgin
Grant, I still need feedback to check this problem...
[7 Jun 2007 23:00] Bugs System
No feedback was provided for this bug for over a month, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
[28 May 2013 8:21] Bogdan Degtyariov
Cannot continue without feedback from the reporter.
The bug is closed.