Salve a tutti: ho creato una pagina Asp che si connette ad un db MSSQL e poi estrae i dati per paginarli, ma mi dà errore, e sinceramente non capisco dove!.
Vi posto il codice sperando che qualcuno possa aiutarmi:
codice:
<%
Dim conn
Dim strnome
Dim iPageSize
Dim iPageCount
Dim iPageCurrent
Dim strOrderBy
Dim strSQL
Dim RS
Dim iRecordsShown
Dim MioArray
iPageSize = 7
MioArray=Request("ricerca")
If Request.QueryString("page") = "" Then
iPageCurrent = 1
Else
iPageCurrent = CInt(Request.QueryString("page"))
End If
If Request.QueryString("order") = "" Then
strOrderBy = "id"
Else
strOrderBy = Request.QueryString("order")
End If
Conn = "Trusted_Connection=no;Provider=SQLOLEDB;Data Source=82.104.xx.xxx;Initial Catalog=nomedb;User ID=utente;password=password"
Set rs = Server.CreateObject("ADODB.recordset")
rs.Open sql, Conn
sql = "SELECT * FROM IC_FABB"
RS.Open sql, conn, adOpenKeyset
RS.PageSize = iPageSize
RS.CacheSize = iPageSize
iPageCount = RS.PageCount
If iPageCurrent > iPageCount Then iPageCurrent = iPageCount
If iPageCurrent < 1 Then iPageCurrent = 1
If iPageCount = 0 Then
Response.Write("Nessun record visualizzato")
Else
RS.AbsolutePage = iPageCurrent
iRecordsShown = 0
Do While iRecordsShown < iPageSize And Not RS.EOF
%>
<% response.write (rs("C_COMUNE") %>
<%
iRecordsShown = iRecordsShown + 1
RS.MoveNext
Loop
End If
RS.Close
Set RS = Nothing
Conn.Close %>
<%
If iPageCurrent <> 1 Then
%>
<font face="Arial" size="2">Indietro</font>
<%
End If
%>
<%
If iPageCurrent < iPageCount Then
%>
<font size="2" face="Arial">
Avanti
</font>
<%
End If
%>