Pagina 1 di 2 1 2 ultimoultimo
Visualizzazione dei risultati da 1 a 10 su 11

Discussione: RIchiesta Errore

  1. #1
    Utente di HTML.it
    Registrato dal
    Jan 2008
    Messaggi
    30

    RIchiesta Errore

    Microsoft OLE DB Provider for ODBC Drivers error '80040e14'

    [Microsoft][ODBC Microsoft Access Driver] Syntax error in WHERE clause.

    /gestione/clienti.asp, line 153



    Ragazzi andando a creare un nuovo campo di filtraggio per la ricerca mi ritrovo quest'errore...essendo ancora molto inesperto su asp potreste gentilmente dirmi come provare a risolverlo??? Vi ringrazio

  2. #2
    Dovresti perlomeno postare la parte di codice interessata. In particolare la riga 153 con la clausola where.

  3. #3
    Utente di HTML.it
    Registrato dal
    Jan 2008
    Messaggi
    30

    :D

    <%@ Language = VBScript %>

    <html>
    <head>
    <meta http-equiv="Content-Language" content="it">
    <meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
    <title>Toscana Luce - GESTIONE</title>
    <link href="css/style.css" rel="stylesheet" type="text/css" media="screen">
    </head>

    <%if request.QueryString("sblocca") <> "" then%>
    <%conn.close%>
    <%set conn = nothing%>
    <%end if%>

    <body>





    <table style="width:90%; margin-top:30px;" align="center">
    <tr>
    <td colspan="10" style="text-align:center; font-weight:bold; font-size:120%;">
    Gestione clienti


    Aggiungi cliente


    </td>
    </tr>

    <tr>
    <td>
    <form name="src_clienti" id="src_clienti" method="post" action="clienti.asp">
    <input type="hidden" name="filtro" id="filtro" value="attivo">
    <table style="width:920px; font-size:70%; border:1px solid #CCC;" align="center">
    <tr>
    <td colspan="10" style="background-color:#CCC; text-align:center;">
    <strong style="font-size:120%;">Filtra i risultati[/b]
    </td>
    </tr>
    <tr>
    <td>Ragione sociale</td>
    <td>Città</td>
    <td>Provincia</td>
    <td>Telefono</td>
    <td>Aziende</td>
    <td>Riferimento</td>
    </tr>
    <tr>
    <td>
    <input type="text" name="src_RAGIONE_SOCIALE" id="src_RAGIONE_SOCIALE" value="<%=request.form("src_RAGIONE_SOCIALE")%>" style="width:100px;">
    </td>
    <td>
    <input type="text" name="src_CITTA" id="src_CITTA" value="<%=request.form("src_CITTA")%>" style="width:100px;">
    </td>
    <td>
    <input type="text" name="src_PROV" id="src_PROV" value="<%=request.form("src_PROV")%>" style="width:40px;">
    </td>
    <td>
    <input type="text" name="src_TEL" id="src_TEL" value="<%=request.form("src_TEL")%>" style="width:100px;">
    </td>
    <td>
    <input type="text" name="src_TITOLO" id="src_TITOLO" value="<%=request.form("src_TITOLO")%>" style="width:100px;">
    </td>
    <td>
    <select name="src_ID_RIFERIMENTO" id="src_ID_RIFERIMENTO">
    <%
    sql1 = "SELECT * "
    sql1 = sql1 & "FROM AGENTI "
    sql1 = sql1 & "ORDER BY COGNOME;"
    Set rs1 = Server.CreateObject("ADODB.Recordset")
    rs1.Open sql1, conn, 1, 3, 1%>
    <option value="0">...</option>
    <%
    do while not rs1.eof
    %>
    <option value="<%=rs1("ID_AGENTE")%>"><%=rs1("NOME") & " " & rs1("COGNOME")%></option>
    <%
    rs1.movenext
    loop
    rs1.close
    set rs1 = nothing
    %>
    </select>
    </td>
    </tr>
    <tr>
    <td style="text-align:center; font-size:12px;" colspan="10">


    <input type="submit" value="FILTRA" name="src_filtra" id="src_filtra" style="font-size:18px;">

    rimuovi filtri
    </td>
    </tr>

    <%
    'recordset clienti
    insertAND = false
    if request.Form("filtro") = "" then
    sql = "SELECT CLIENTI.*,MARCHI.TITOLO as MARCHIO, AGENTI.COGNOME as AGENTE "
    sql = sql & "FROM AGENTI RIGHT JOIN CLIENTI ON AGENTI.ID_AGENTE = CLIENTI.ID_RIFERIMENTO "
    sql = sql & "ORDER BY RAGIONE_SOCIALE;"
    else
    sql = "SELECT CLIENTI.*,MARCHI.TITOLO as MARCHIO, AGENTI.COGNOME as AGENTE "
    sql = sql & "FROM AGENTI RIGHT JOIN CLIENTI ON AGENTI.ID_AGENTE = CLIENTI.ID_RIFERIMENTO "
    sql = sql & "WHERE "
    if request.Form("src_RAGIONE_SOCIALE") <> "" then
    if insertAND then sql = sql & "AND "
    sql = sql & "RAGIONE_SOCIALE like '%" & request.Form("src_RAGIONE_SOCIALE") & "%' "
    insertAND = true
    end if
    if request.Form("src_CITTA") <> "" then
    if insertAND then sql = sql & "AND "
    sql = sql & "CITTA like '%" & request.Form("src_CITTA") & "%' "
    insertAND = true
    end if
    if request.Form("src_PROV") <> "" then
    if insertAND then sql = sql & "AND "
    sql = sql & "PROVINCIA like '%" & request.Form("src_PROV") & "%' "
    insertAND = true
    end if
    if request.Form("src_TEL") <> "" then
    if insertAND then sql = sql & "AND "
    sql = sql & "TEL_UFFICIO like '%" & request.Form("src_TEL") & "%' "
    insertAND = true
    end if
    if cstr(request.Form("src_ID_RIFERIMENTO")) <> "0" then
    if insertAND then sql = sql & "AND "
    sql = sql & "ID_RIFERIMENTO = " & request.Form("src_ID_RIFERIMENTO") & " "
    insertAND = true
    end if
    if request.Form("src_TITOLO") <> "" then
    if insertAND then sql = sql & "AND "
    sql = sql & "TITOLO like '%" & request.Form("src_TITOLO") & "%' "
    insertAND = true
    end if
    sql = sql & "ORDER BY RAGIONE_SOCIALE;"
    end if
    var_sql = sql
    %>
    </form>
    <tr>
    <td style="text-align:center;" colspan="10">


    <form action="http://www.toscanaluce.com/gestione/mail/newsletter.asp" method="post" name="nl">
    <input type="hidden" value="<%=var_sql%>" name="lista_sql">
    <input type="submit" value="invia mail ai clienti selezionati" style="font-size:18px;">
    </form>
    </td>
    </tr>
    </table>

    </td>
    </tr>

    <tr>
    <td style="text-align:left;">
    <%
    Set rs = Server.CreateObject("ADODB.Recordset")
    rs.Open sql, conn, 1, 3, 1
    if not rs.eof then
    %>
    <table style="width:100%; font-size:90%;" cellspacing="0" cellpadding="2">
    <tr style="background-color:#666; color:#fff;">
    <td>Ragione sociale</td>
    <td>Città</td>
    <td>Rif.</td>
    <td></td>
    </tr>
    <%do while not rs.eof%>
    <%if bgcol = "#c2c2c2" then bgcol = "#ffffff" else bgcol = "#ffffff"%>
    <tr style="background-color:<%=bgcol%>;">
    <td>"><%=rs("RAGIONE_SOCIALE")%></td>
    <td><%=rs("CITTA")%></td>
    <td><%=rs("AGENTE")%></td>
    <%
    sql1 = "SELECT VISITE.DATA_VISITA "
    sql1 = sql1 & "FROM VISITE "
    sql1 = sql1 & "WHERE VISITE.ID_CLIENTE = " & rs("ID_CLIENTE") & " AND DATA_VISITA >= #" & day(now()) & "/" & month(now()) & "/" & year(now()) & "#;"
    Set rs1 = Server.CreateObject("ADODB.Recordset")
    rs1.Open sql1, conn, 1, 3, 1
    if not rs1.eof then var_alert = true else var_Alert = false
    rs1.close
    set rs1 = nothing
    %>

    <td style="text-align:right;">
    <%if var_alert then%>
    ">[img]img/tool_alert.png[/img]
    <%end if%>
    ">[img]img/tool_edit.png[/img]
    ">[img]img/tool_delete.png[/img]
    </td>
    </tr>
    <tr>
    <td colspan="10">
    <div style="width:100%; border-bottom:1px dotted #c2c2c2;"></div>
    </td>
    </tr>
    <%
    rs.movenext
    loop
    rs.close
    set rs = nothing
    %>
    </table>
    <%else%>
    Nessun cliente presente in archivio, fai clic qui per aggiungere un cliente.
    <%end if%>
    </td>
    </tr>
    </table>

    <%conn.close%>
    <%set conn = nothing%>

    <table style="margin-top:50px; background-color:#CCC; width:90%;" align="center">
    <tr>
    <td style="text-align:center;" class="bottombar">
    Torna al pannello di controllo
    </td>
    </tr>
    </table>

    </body>
    </html>

  4. #4
    la riga incriminata, please, non tutto il codice

  5. #5
    Moderatore di JavaScript L'avatar di br1
    Registrato dal
    Jul 1999
    Messaggi
    19,998
    A vedere il tuo codice 90% di probabilita' e' che sia perche' in un campo del form e' stata introdotta una stringa che contiene un apice... e tu non li raddoppi quando li inserisci nella query
    Il guaio per i poveri computers e' che sono gli uomini a comandarli.

    Attenzione ai titoli delle discussioni: (ri)leggete il regolamento
    Consultate la discussione in rilievo: script / discussioni utili
    Usate la funzione di Ricerca del Forum

  6. #6
    Utente di HTML.it
    Registrato dal
    Jan 2008
    Messaggi
    30
    <%
    Set rs = Server.CreateObject("ADODB.Recordset")
    rs.Open sql, conn, 1, 3, 1
    if not rs.eof then
    %>


    in particolare la parte segnalata è rs.Open sql,conn, 1, 3, 1


    Questa è la riga incriminata...aiutatemi please

  7. #7
    Moderatore di JavaScript L'avatar di br1
    Registrato dal
    Jul 1999
    Messaggi
    19,998
    Originariamente inviato da br1
    A vedere il tuo codice 90% di probabilita' e' che sia perche' in un campo del form e' stata introdotta una stringa che contiene un apice... e tu non li raddoppi quando li inserisci nella query
    Facci vedere la query completa di variabili...
    Il guaio per i poveri computers e' che sono gli uomini a comandarli.

    Attenzione ai titoli delle discussioni: (ri)leggete il regolamento
    Consultate la discussione in rilievo: script / discussioni utili
    Usate la funzione di Ricerca del Forum

  8. #8
    Utente di HTML.it
    Registrato dal
    Jan 2008
    Messaggi
    30
    <td>
    <input type="text" name="src_TITOLO" id="src_TITOLO" value="<%=request.form("src_TITOLO")%>" style="width:100px;">
    </td>



  9. #9
    Originariamente inviato da alex159
    <td>
    <input type="text" name="src_TITOLO" id="src_TITOLO" value="<%=request.form("src_TITOLO")%>" style="width:100px;">
    </td>


    questa NON è la query. la query è la variabile sql che usi qui

    <%
    Set rs = Server.CreateObject("ADODB.Recordset")
    rs.Open sql, conn, 1, 3, 1
    if not rs.eof then
    %>


    trasformala così

    <%
    Set rs = Server.CreateObject("ADODB.Recordset")
    Response.Write "
    maGGica sql....: " & sql
    Response.Flush

    rs.Open sql, conn, 1, 3, 1
    if not rs.eof then
    %>

    e posta quello che viene a video

  10. #10
    Utente di HTML.it
    Registrato dal
    Jan 2008
    Messaggi
    30
    maGGica sql....: SELECT CLIENTI.*,MARCHI.TITOLO as MARCHIO, AGENTI.COGNOME as AGENTE FROM AGENTI RIGHT JOIN CLIENTI ON AGENTI.ID_AGENTE = CLIENTI.ID_RIFERIMENTO WHERE TITOLO like '%simes%' ORDER BY RAGIONE_SOCIALE;


    Questo è quello che viene a video!!!

Permessi di invio

  • Non puoi inserire discussioni
  • Non puoi inserire repliche
  • Non puoi inserire allegati
  • Non puoi modificare i tuoi messaggi
  •  
Powered by vBulletin® Version 4.2.1
Copyright © 2025 vBulletin Solutions, Inc. All rights reserved.