-
Passato a Mssql da Access, ho un problema ad ordinare i record; ho questa funzione qui che non so come correggere. I record vengono ordinati in base all'id e in modo ascendente:
id 1
id 2
id 3
id 4
eccquindi le sessioni create nel cod qui sotto sembra che vengono ignorate.
Come si vede dal codice, alcuni record vengono esclusi (quelli che contengono un det valore nel campo categoria). L'esclusione funziona ma la data nn viene presa in considerazione.
In mssql il formato data è 'datetime'.Un grazie per l'eventuale aiuto

<% DefaultOrder = "date" DefaultOrderType = "DESC" OrderBy = "" If Request.QueryString("order").Count > 0 Then OrderBy = Request.QueryString("order") If Session("accouncements_OB") = OrderBy Then If Session("accouncements_OT") = "ASC" Then Session("accouncements_OT") = "DESC" Else Session("accouncements_OT") = "ASC" End if Else Session("accouncements_OT") = "ASC" End If Session("accouncements_OB") = OrderBy Session("accouncements_REC") = 1 Else OrderBy = Session("accouncements_OB") if OrderBy = "" then OrderBy = DefaultOrder Session("accouncements_OB") = OrderBy Session("accouncements_OT") = DefaultOrderType End If End If If Request.QueryString("start").Count > 0 Then startRec = Request.QueryString("start") Session("accouncements_REC") = startRec Else startRec = Session("accouncements_REC") if not isnumeric(startRec) or startRec = "" then startRec = 1 Session("accouncements_REC") = startRec End If End If set conn = Server.CreateObject("ADODB.Connection") conn.Open xDb_Conn_Str strsql = "select * from [Files]" escludi = ("escludi") If dbwhere <> "" Then strsql = strsql & " WHERE NOT categoria = '"& escludi &"' " End If if OrderBy <> "" then strsql = strsql & " ORDER BY [" & OrderBy & "] " & Session("accouncements_OT") end if set rs = Server.CreateObject("ADODB.Recordset") rs.Open strsql, conn, 1, 2 totalRecs = rs.RecordCount %>
Ciao! Sembra che tu sia interessato a questa conversazione, ma non hai ancora un account.
Stanco di dover scorrere gli stessi post a ogni visita? Quando registri un account, tornerai sempre esattamente dove eri rimasto e potrai scegliere di essere avvisato delle nuove risposte (tramite email o notifica push). Potrai anche salvare segnalibri e votare i post per mostrare il tuo apprezzamento agli altri membri della comunità.
Con il tuo contributo, questo post potrebbe essere ancora migliore 💗
Registrati Accedi