fatti stampare STRSQL e controllala (oppure postala che la si controlla assieme)
fatti stampare STRSQL e controllala (oppure postala che la si controlla assieme)
Tutto ok, era un mio errore avevo lasciato al where il nome della colonna.
Se volessi modificare la paginazione in modo che si vedessero i numeri delle pagine passate?
Lo script così comè quando passo alla seconda pagina mi fa vedere: indietro 2 - 3 - 4 avanti
Invece come posso modificarlo in modo che mi facesse vedere il numero delle pagine passate esempio:
indietro 1 - 2 - 3 avanti anche mi se mi trovo alla 2 o terza pagina
Grazie 1000codice:<% page = page totPage = pagine_totali Max = 9 startPage = page EndPage = page + Max if page > 1 then Response.write("<a href=""search.asp?page="& page -1 &""">Indietro</a> ") end if if EndPage > totPage then EndPage = totPage for i = StartPage to EndPage If i = totPage then Response.Write("") Else If i = page then Response.Write("<b>" & i & "</b>") else Response.write ("<a href=""search.asp?page=" & i & """> " & i & " </a> ") end if end if next if page < totpage then Response.write (" <a href=""search.asp?page=" & page +1 & """>Avanti</a> ") end if %>
direi che si tratta di tutt'altro problema: che ne dici di aprire un altro thread?
sarebbe anche bello che tu postassi la soluzione, per capire come l'hai effettivamente implementata
Giusto eccola:
codice:ricerca = request.querystring("keywords") sek=split(ricerca," ") myWHERE = "" for i=0 to ubound(sek) if len(sek(i))>2 then if i>0 then myWHERE = myWHERE + " OR " end if myWHERE = myWHERE & " MYCOLUMN LIKE '%" & sek(i) & "%' " end if next myQuery1=replace(myWHERE, "MYCOLUMN", "DESCRIZIONE") myQuery2=replace(myWHERE, "MYCOLUMN", "PIANO_OPERA") strSQL = "SELECT * FROM (" strSQL = strSQL & "SELECT *" strSQL = strSQL & "FROM miatab WHERE "&myQuery1&" " strSQL = strSQL & "UNION " strSQL = strSQL & "SELECT *" strSQL = strSQL & "FROM miatab WHERE "&myQuery2&" " strSQL = strSQL & ") " Set objRS = objConn.Execute(strSQL)
tutto sto casino per due colonne? avevi detto che ne avevi mille mila... (al netto che può sempre servire)
è ridotto volutamente ma effettivamente ne avevo na cinquatina di colonne per tabella
ooookkkey!
allora se vuoi risparmiare un po' di variabili puoi fare così
'... togli myQuery1=... myQuery2=...
strSQL ="SELECT * FROM ("
strSQL = strSQL &"SELECT * "
strSQL = strSQL &"FROM miatab WHERE " & replace(myWHERE,"MYCOLUMN","DESCRIZIONE") & " "
strSQL = strSQL &"UNION "
strSQL = strSQL &"SELECT * "
strSQL = strSQL &"FROM miatab WHERE " & replace(myWHERE,"MYCOLUMN","PIANO_OPERA") & " "
strSQL = strSQL &") "
Set objRS = objConn.Execute(strSQL)
--------------
inoltre non vedo l'implementazione della SELECT col nome di colonna, hai messo una SELECT *
hai semplificato un po' troppo e non si vede una parte importante dell'implementazione!
hai ragione.... ho fatto un copia-incolla errato ecco completo del tuo ultimo suggerimento!!
codice:ricerca = request.querystring("keywords") sek=split(ricerca," ") myWHERE = "" for i=0 to ubound(sek) if len(sek(i))>2 then if i>0 then myWHERE = myWHERE + " OR " end if myWHERE = myWHERE & " MYCOLUMN LIKE '%" & sek(i) & "%' " end if next strSQL = "SELECT * FROM (" strSQL = strSQL & "SELECT 'miatab' AS nome_db, 'MIACOLONNA1' AS nome_colonna, id AS id_riga, MIACOLONNA1 AS Valore " strSQL = strSQL & "FROM miatab WHERE "&replace(myWHERE, "MYCOLUMN", "DESCRIZIONE")&" " strSQL = strSQL & "UNION " strSQL = strSQL & "SELECT 'miatab' AS nome_db, 'MIACOLONNA2' AS nome_colonna, id AS id_riga, MIACOLONNA2 AS Valore " strSQL = strSQL & "FROM miatab WHERE "&replace(myWHERE, "MYCOLUMN", "PIANO_OPERA")&" " strSQL = strSQL & ") " Set objRS = objConn.Execute(strSQL)
Scusate se riapro questo post, ma ho riscontrato un errore non testato per dimenticanza, lo script dovrebbe escludere le ricerca al di sotto di 2 caratteri, mentre che succede, la ricerca la fa dai 2 caratteri a scendere ma va in errore db
Microsoft OLE DB Provider for ODBC Drivers error '80040e14'
[MySQL][ODBC 3.51 Driver][mysqld-5.5.59-38.11-log]You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near
etc..
la risposta è la solita da 12.758 anni: fatti stampare strSQL e postala