ok, ho rifatto la pagina più corta...
<script runat="server">
dim varlocator as string
dim forumid, ordinato, come
Sub page_load(obj as object, e as eventargs)
forumid = request.querystring("forum")
dim i, nomeforum
if request.querystring("forum") = ""
response.redirect("forums.aspx")
end if
Dim sql0 As String
Dim objConn0 = New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0; Data Source=c:\inetpub\wwwroot\DataS\ForumS.mdb")
objConn0.open
sql0="SELECT * FROM forum WHERE id = " & request.querystring("forum")
Dim objCommand0 as New OleDbCommand(sql0 , objconn0)
Dim objDataReader0 as OleDbDataReader
objDataReader0 = objCommand0.ExecuteReader
if objDataReader0.read
if objDataReader0.item("id").tostring <> ""
nomeforum = objdatareader0("forum")
end if
end if
objConn0.close
if forumid = "" then
response.redirect("forums.aspx")
end if
if ordinato = ""
ordinato = "ultima_risposta_data"
end if
if come = ""
come = "desc"
end if
Dim ds as DataSet = new DataSet()
Dim myConnection as New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0; Data Source=c:\inetpub\wwwroot\DataS\ForumS.mdb")
Dim myCommand as New OleDbDataAdapter("SELECT * FROM thread WHERE idforum = " & forumid & " ORDER BY " & ordinato & " " & come, myConnection)
myCommand.fill(ds, "thread")
showforum.datasource = ds.Tables("thread")
databind()
end sub
sub orderby(obj as object, e as eventargs)
ordinato = "visite"
come = "desc"
Page_Load(obj, e)
databind()
end sub
</script>
Ovviamente var1 corrisponde ad ordinato e orderby corrisponde a button_click
Graze!![]()