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="typelib"
FILE="C:\Program Files\Common Files\System\ADO\msado20.tlb"
-->
<%
Response.Buffer = True
Dim iCurrentPage
iCurrentPage = Request.QueryString ("pg"

If iCurrentPage = "" Then iCurrentPage = 1
Dim oPg
Set oPg = New DbPager
'Set public properties of the Pager Class
With oPg
.DataSource = "Provider=SQLOLEDB; Data_Source=(local); Initial Catalog=Northwind; User Id=sa; Password=;"
.RecsPerPage = 10
.SQL = "SELECT * FROM Customers ORDER BY CompanyName"
.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 ("ADODB.Recordset"
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 "<TABLE Border=1 Width='100%'>"
'a routine to write the page navigation
WriteNavigation iCurrentPage, iNumPages, iNumFields
'Write all the field names
'as column headings
Response.Write "<TR>"
For iFld = 0 To iNumFields - 1
Response.Write "<TD>" & Rs.Fields(iFld).Name & "</TD>"
Next
Response.Write "<TR>"
'Write the cell values
For i = 1 To m_iRecsPerPage
If Rs.EOF Then Exit For
Response.Write "<TR>"
For iFld = 0 To iNumFields - 1
Response.Write "<TD>" & Rs.Fields(iFld).Value & "</TD>"
Next
Response.Write "</TR>"
Rs.MoveNext
Next
Response.Write "</TABLE>"
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 ("SCRIPT_NAME"
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 "<TR>"
Response.Write "<TD Colspan='" & iNumFields & "' Align=Center>"
'previous page
Response.Write "<A HREF='" & sScriptName & "?pg=" & iPreviousPage & "'>Prev</A> "
'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 "<B>" & i & "</B>"
Else
Response.Write "<A HREF='" & Request.Servervariables("SCRIPT_NAME"

& "?pg=" & i & "'>"
Response.Write i & "</A>"
End If
Response.Write " "
Next
End If
'next page navigation
Response.Write " <A HREF='" & sScriptName & "?pg=" & iNextPage & "'>Next</A>"
Response.Write "</TD>"
Response.Write "</TR>"
End Sub
End Class
%>
Anyone can guide me please..
thanks in advance