Visualizzazione dei risultati da 1 a 5 su 5
  1. #1

    errore: tipi di dati non corrispondenti

    Ciao a tutti,sto creando un negozio e-commerce dal libro "commercio elettronico con asp". cliccando sul pulsante "add to cart" di un prodotto,mi si apre la pagina di registrazione funzionante dove devo compilare tutti i campi. Una vota compilato i campi e clicco su registrati, mi dovrebbe uscire cart.asp , ma purtroppo mi da questo errore:

    --------------------------------

    Tipo di errore:
    Microsoft OLE DB Provider for ODBC Drivers (0x80040E07)
    [Microsoft][Driver ODBC Microsoft Access] Tipi di dati non corrispondenti nell'espressione criterio.
    /pp/storefuncs.asp, line 182

    -------------------------------------

    e da ieri che provo a controllare il codice ed il data base alla ricerca dell errore ma niente non ci riesco, mi sapete dire dove' che sbaglio.

  2. #2
    se non vedere codice non capire errore

  3. #3
    Beh..come dice l'errore probabilmente tenti di inserire un valore non valido.
    Potrebbe essere un numero che esca fuori dei range che hai stabilito nel database.
    Controlla i criteri che hai messo nel database.

  4. #4
    questa e' la pagina dove mi trova l'errore:

    <%
    '==========================
    ' Common Functions
    '==========================
    FUNCTION fixQuotes( theString )
    fixQuotes = REPLACE( theString, "'", "''" )
    END FUNCTION


    SUB addCookie( theName, theValue )
    Response.Cookies( theName ) = theValue
    Response.Cookies( theName ).Expires = "July 31, 2001"
    Response.Cookies( theName ).Path = "/"
    Response.Cookies( theName ).Secure = FALSE
    END SUB



    FUNCTION checkpassword( byVal username, byVal password, byRef Con )
    sqlString = "SELECT user_id FROM users " &_
    "WHERE user_username='" & username & "' " &_
    "AND user_password='" & password & "'"
    SET RS = Con.Execute( sqlString )
    IF RS.EOF THEN
    checkpassword = - 1
    ELSE
    checkpassword = RS( "user_id" )
    addCookie "username", username
    addCookie "password", password
    END IF
    END FUNCTION


    FUNCTION SELECTED( firstVal, secondVal )
    IF cSTR( firstVal ) = cSTR( secondVal ) THEN
    SELECTED = " SELECTED "
    ELSE
    SELECTED = ""
    END IF
    END FUNCTION

    SUB errorForm( errorMSG, backpage )
    %>
    <html>
    <head><title>Problem</title></head>
    <body bgcolor="lightyellow">

    <center>
    <table width="500" border=1
    cellpadding=5 cellspacing=0>
    <tr>
    <td>
    <font face="Arial" size="3" color="darkblue">
    Errore nella compilazione del form:
    </font>
    <font size="2" color="red">

    <%=errorMSG%>
    </font>


    <form method="post" action="<%=backpage%>">
    <input name="error" type="hidden" value="1">
    <% formFields %>
    <input type="submit" value="Return">
    </form>
    </td>
    </tr>
    </table>
    </center>

    </body>
    </html>
    <%
    Response.End
    END SUB


    SUB formFields
    FOR each item in Request.Form
    %>
    <input name="<%=item%>" type="hidden"
    value="<%=Server.HTMLEncode( Request( item ) )%>">
    <%
    NEXT
    END SUB

    '===========================
    ' Registration Functions
    '===========================


    Sub addUser
    'Estrazione campi di registrazione
    newusername = TRIM( Request( "newusername" ) )
    newpassword = TRIM( Request( "newpassword" ) )
    email = TRIM( Request( "email" ) )
    street = TRIM( Request( "street" ) )
    city = TRIM( Request( "city" ) )
    state = TRIM( Request( "state" ) )
    zip = TRIM( Request( "zip" ) )
    cctype = TRIM( Request( "cctype" ) )
    ccnumber = TRIM( Request( "ccnumber" ) )
    ccexpires = TRIM( Request( "ccexpires" ) )
    ccname = TRIM( Request("ccname" ) )

    'Verifica campi richiesti
    backpage = Request.ServerVariables( "SCRIPT_NAME" )
    IF newusername = "" THEN
    errorForm "Inserisci di nuovo il nome utente.", backpage
    END IF
    IF newpassword = "" THEN
    errorForm "Inserisci di nuovo la password.", backpage
    END IF
    IF email = "" THEN
    errorForm "Inserisci di nuovo l'email.", backpage
    END IF
    IF street = "" THEN
    errorForm "Inserisci di nuovo l'indirizzo.", backpage
    END IF
    IF city = "" THEN
    errorForm "Inserisci di nuovo la città.", backpage
    END IF
    IF state = "" THEN
    errorForm "Inserisci di nuovo lo Stato.", backpage
    END IF
    IF zip = "" THEN
    errorForm "Inserisci di nuovo il codice C.A.P.", backpage
    END IF
    IF ccnumber = "" THEN
    errorForm "Inserisci di nuovo il numero di Carta.", backpage
    END IF
    IF ccexpires = "" THEN
    errorForm "Inserisci di nuovo la scadenza della Carta.", backpage
    END IF
    IF ccname = "" THEN
    errorForm "Inserisci di nuovo l'Intestatario.", backpage
    END IF

    'Verifica dei necessari valori dei campi
    IF invalidEmail ( email ) THEN
    errorForm "Non hai inserito un e-mail valida", backpage
    END IF
    IF NOT validCCNumber( ccnumber ) THEN
    errorForm "Non hai inserito un numero di Carta valido", backpage
    END IF
    IF NOT isDate( ccexpires ) THEN
    errorForm "Inserisci di nuovo la scadenza della Carta", backpage
    END IF

    'Verifica utente gia' registrato
    IF alreadyUser( newusername ) THEN
    errorForm "Nick già esistente. Prova ad inserirne un altro.", backpage
    END IF


    ' Add New User to Database
    sqlString = "INSERT INTO users ( " &_
    "user_username, " &_
    "user_password, " &_
    "user_email," &_
    "user_street, " &_
    "user_city," &_
    "user_state," &_
    "user_zip," &_
    "user_ccnumber, " &_
    "user_cctype, " &_
    "user_ccexpires," &_
    "user_ccname" &_
    ") VALUES ( " &_
    " '" & fixQuotes( newusername ) & "', " &_
    " '" & fixQuotes( newpassword ) & "', " &_
    " '" & fixQuotes( email ) & "', " &_
    " '" & fixQuotes( street ) & "', " &_
    " '" & fixQuotes( city ) & "', " &_
    " '" & fixQuotes( state ) & "', " &_
    " '" & fixQuotes( zip ) & "', " &_
    " " & fixQuotes( ccnumber ) & ", " &_
    " '" & cctype & "', " &_
    " '" & ccexpires & "', " &_
    " '" & fixQuotes( ccname ) & "' " &_
    ")"

    Con.Execute sqlString

    'Utilizzo nuovo username e nuova password
    username = newusername
    password = newpassword

    'Aggiunta cookie
    addCookie "username", username
    addCookie "password", password
    END SUB


    SUB updateUSER
    'Estrazione dei campi di registrazione
    street = TRIM(Request( "street" ) )
    city = TRIM(Request( "city" ) )
    state = TRIM(Request( "state") )
    zip = TRIM(Request( "zip" ) )
    cctype = TRIM(Request( "cctype" ) )
    ccnumber = TRIM(Request( "ccnumber" ) )
    ccexpires = TRIM(Request( "ccexpires" ) )
    ccname = TRIM(Request( "ccname" ) )

    'Controllo dei campi richiesti
    backpage = "checkout.asp"
    IF street = "" THEN
    errorForm "Inserisci il tuo indirizzo.", backpage
    END IF
    IF city = "" THEN
    errorForm "You must enter your city.", backpage
    END IF
    IF state = "" THEN
    errorForm "Inserisci il tuo stato.", backpage
    END IF
    IF zip = "" THEN
    errorForm "Inserisci il tuo C.A.P.", backpage
    END IF
    IF ccnumber = "" THEN
    errorForm "Inserisci il codice della carta.", backpage
    END IF
    If ccexpires = "" THEN
    errorForm "Inserisci la data di scadenza della carta.", backpage
    END IF
    IF ccname = "" THEN
    errorForm "Inserisci il nome dell'intestatario della carta.", backpage
    END IF

    'Controllo dei valori necessari dei campi
    IF INSTR( ccnumber, "*" ) = 0 THEN
    IF NOT validCCNumber( ccnumber ) THEN
    errorForm "Non hai inserito il codice corretto della carta.", backpage
    ELSE
    ccnumber = "'" & ccnumber & "'"
    END IF
    ELSE
    ccnumber = "user_ccnumber"
    END IF
    IF NOT isDate( ccexpires ) THEN
    errorForm "La data di scadenza della carta non è valida", backpage
    END IF

    'Aggiornamento delle informazioni sull'utente nel database
    sqlString = "UPDATE users SET " &_
    "user_street='" & fixQuotes( street ) & "', " &_
    "user_city='" & fixQuotes( city ) & "'," &_
    "user_state='" & fixQuotes( state ) & "'," &_
    "user_zip='" & fixQuotes( zip ) & "'," &_
    "user_ccnumber=" & ccnumber & ", " &_
    "user_cctype=" & cctype & ", " &_
    "user_ccexpires='" & ccexpires & "'," &_
    "user_ccname='" & fixQuotes( ccname ) & "' " &_
    "WHERE user_id=" & userID

    Con.Execute sqlString
    END SUB

    FUNCTION invalidEmail( email )
    IF INSTR( email, "@" ) = 0 OR INSTR( email, "." ) = 0 THEN
    invalidEmail = TRUE
    ELSE
    invalidEmail = FALSE
    END IF
    END FUNCTION

    FUNCTION validCCNumber( ccnumber )
    ccnumber = CleanCCNum( ccnumber )
    IF ccnumber = "" THEN
    validCCNumber = FALSE
    ELSE
    isEven = False
    digits = ""
    for i = Len( ccnumber ) To 1 Step -1
    if isEven Then
    digits = digits & CINT( MID( ccnumber, i, 1) ) * 2
    Else
    digits = digits & CINT( MID( ccnumber, i, 1) )
    End If
    isEven = (Not isEven)
    Next
    checkSum = 0
    For i = 1 To Len( digits) Step 1
    checkSum = checkSum + CINT( MID( digits, i, 1 ) )
    Next
    validCCNumber = ( ( checkSum Mod 10) = 0 )
    END IF
    End Function

    FUNCTION alreadyUser( theUsername )
    sqlString = "SELECT user_username FROM users " &_
    "WHERE user_username='" & fixQuotes( theUsername ) & "'"
    SET RS = Con.Execute( sqlString )
    IF RS.EOF THEN
    alreadyUser = FALSE
    ELSE
    alreadyUser = TRUE
    END IF
    RS.Close
    END FUNCTION



    FUNCTION CleanCCNum( ccnumber )
    FOR i = 1 TO LEN( ccnumber )
    IF isNumeric( MID( ccnumber, i, 1 ) ) THEN
    CleanCCNum = CleanCCNum & MID( ccnumber, i, 1 )
    END IF
    NEXT
    END FUNCTION



    '======================
    ' ACCOUNT FUNCTIONS
    '======================

    FUNCTION showOrderStatus( theStatus, theShipDate )
    SELECT CASE theStatus
    CASE 0
    showOrderStatus = "Pending"
    CASE 1
    showOrderStatus = "Problem with Credit Card"
    CASE 2
    showOrderStatus = "Product not in stock"
    CASE 3
    showOrderStatus = "Shipped on " & theShipDate
    CASE ELSE
    showOrderStatus = "Unknown"
    END SELECT
    END FUNCTION



    %>


    ho controllato tutto, ma non riesco a capire dove sta lo sbaglio, se vuoi ti do il codice della pagina che viene prima "register.asp", e anche la pagina dopo la registrazione "cart.asp"

  5. #5
    o niente, o troppo... quale riga dà l'errore? posta QUALCHE riga prima e QUALCHE riga dopo.

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.