Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Getting VBScript compilation error '800a03ea'

Status
Not open for further replies.

tondarb

Programmer
Oct 8, 2003
37
US
Hi,
I have used the code which jfriestman has kept in the FAQ's for paging through a recordset. Everything is ok, and it is working on the local system, but when I kept on the web it is giving this error...


Microsoft VBScript compilation error '800a03ea'

Syntax error

/members/AdminMemList.asp, line 106

Set oPg = New DbPager
----------^


please help me

thanks in advance
 
hi,

but I think this code is for asp bcos inside the code response.write is there and in Vb if we create a dll can it work with this code inside the dll?

See it is working in the local system, but when i kept it on the web it is not working, now I can't change the code.

I want to know why it is giving error on web

hi jhall01

The source code which jfriestman written is



<%@ Language=VBScript %>
<% Option Explicit %>

<%
'include a reference to the ADO type library
'so we can use the ADO constants
%>
<!-- METADATA
TYPE=&quot;typelib&quot;
FILE=&quot;C:\Program Files\Common Files\System\ADO\msado20.tlb&quot;
-->

<%
Response.Buffer = True
Dim iCurrentPage
iCurrentPage = Request.QueryString (&quot;pg&quot;)
If iCurrentPage = &quot;&quot; Then iCurrentPage = 1

Dim oPg
Set oPg = New DbPager

'Set public properties of the Pager Class

With oPg
.DataSource = &quot;Provider=SQLOLEDB; Data_Source=(local); Initial Catalog=Northwind; User Id=sa; Password=;&quot;
.RecsPerPage = 10
.SQL = &quot;SELECT * FROM Customers ORDER BY CompanyName&quot;
.ShowPageNumbers = True
.ShowPage (iCurrentPage)
End With


%>


<%
Class DbPager

'Set a few module level variables
Private m_sDSN
Private m_sSQL
Private m_iRecsPerPage
Private m_bShowPageNumbers

'datasource for the Data Page
Public Property Let DataSource(NewValue) 'As String
m_sDSN = NewValue
End Property

'sql statement to generate the page
Public Property Let SQL(NewValue) 'As String
m_sSQL = NewValue
End Property

'number of records you want per page
Public Property Let RecsPerPage (NewValue) 'As Integer
m_iRecsPerPage = NewValue
End Property

'Boolean to indicate whether or not to show all the page numbers
Public Property Let ShowPageNumbers(NewValue) 'As Boolean
m_bShowPageNumbers = CBool(NewValue)
End Property


'set default values
Private Sub Class_Initialize()
ShowPageNumbers = True
m_iRecsPerPage = 10
End Sub


'INPUT: Page you want to show
'OUTPUT: Html
Public Sub ShowPage (iCurrentPage)


Dim Rs
Set Rs = Server.CreateObject (&quot;ADODB.Recordset&quot;)

With Rs
.CacheSize = m_iRecsPerPage
.PageSize = m_iRecsPerPage '# of records / page
.CursorLocation = adUseClient
'Absolute Page requires Keyset or Static cursor
.CursorType = adOpenKeyset
.Open m_sSQL, m_sDsn
.AbsolutePage = iCurrentPage 'Set the page
End With

'Number of fields, number of pages
Dim iNumFields, iNumPages
iNumFields = Rs.Fields.Count
iNumPages = Rs.PageCount

Dim i, iFld, iRec

Response.Write &quot;<TABLE Border=1 Width='100%'>&quot;

'a routine to write the page navigation
WriteNavigation iCurrentPage, iNumPages, iNumFields


'Write all the field names
'as column headings
Response.Write &quot;<TR>&quot;
For iFld = 0 To iNumFields - 1
Response.Write &quot;<TD>&quot; & Rs.Fields(iFld).Name & &quot;</TD>&quot;
Next
Response.Write &quot;<TR>&quot;


'Write the cell values
For i = 1 To m_iRecsPerPage
If Rs.EOF Then Exit For
Response.Write &quot;<TR>&quot;
For iFld = 0 To iNumFields - 1
Response.Write &quot;<TD>&quot; & Rs.Fields(iFld).Value & &quot;</TD>&quot;
Next
Response.Write &quot;</TR>&quot;
Rs.MoveNext
Next

Response.Write &quot;</TABLE>&quot;

End Sub



'INPUT: Current Page, Number of total pages, number of fields
'OUTPUT: Html for navigating the recordset
Private Sub WriteNavigation(iCurrentPage, iNumPages, iNumFields)

Dim i, sScriptName

sScriptName = Request.ServerVariables (&quot;SCRIPT_NAME&quot;)

iCurrentPage = CInt(iCurrentPage)

Dim iPreviousPage, iNextPage
'at the first page so set the previous page to the last page
If iCurrentPage = 1 Then
iPreviousPage = iNumPages
Else
iPreviousPage = iCurrentPage - 1
End If

'at the last page so set the next page to the first page
If iCurrentPage = iNumPages Then
iNextPage = 1
Else
iNextPage = iCurrentPage + 1
End If

Response.Write &quot;<TR>&quot;
Response.Write &quot;<TD Colspan='&quot; & iNumFields & &quot;' Align=Center>&quot;

'previous page
Response.Write &quot;<A HREF='&quot; & sScriptName & &quot;?pg=&quot; & iPreviousPage & &quot;'>Prev</A> &quot;

'if show all page numbers (clickable)
'this can get out of hand with big recordsets
If m_bShowPageNumbers Then
For i = 1 To iNumPages
If i = iCurrentPage Then
Response.Write &quot;<B>&quot; & i & &quot;</B>&quot;
Else
Response.Write &quot;<A HREF='&quot; & Request.Servervariables(&quot;SCRIPT_NAME&quot;) & &quot;?pg=&quot; & i & &quot;'>&quot;
Response.Write i & &quot;</A>&quot;
End If
Response.Write &quot; &quot;
Next
End If

'next page navigation
Response.Write &quot; <A HREF='&quot; & sScriptName & &quot;?pg=&quot; & iNextPage & &quot;'>Next</A>&quot;
Response.Write &quot;</TD>&quot;
Response.Write &quot;</TR>&quot;
End Sub


End Class
%>



Anyone can guide me please..
thanks in advance

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top