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

    verifica dati uguali in database access

    Ciao a tutti,
    Ho un form in asp che invia i dati inseriti in un database access, funziona tutto, ma vorrei inplementargli la funzione controlla dati inseriti, cioè se un utente inserisce lo stesso dato nel campo link, venga rilanciato l'errore.
    in rete ho trovato questo codice, ma non funziona, nel preciso mi da SYNTAX ERROR alla lettera &..

    code:

    <% ' *** Check New Elements
    FX_flag="MM_insert"
    FX_rs = "" ' used for identification
    FX_found = false
    If (CStr(Request(FX_flag)) <> "") Then
    FX_dupKeyRedirect="esiste_atleta.asp"
    FX_rsKeyConnection=MM_ConnUtentiAmm_STRING
    FX_dupKeyValue = CStr(Request.Form("Link"))

    FX_dupKeySQL="SELECT cadLink FROM tblQCAds WHERE cadLink = '" &
    FX_dupKeyValue & "'AND '" & FX_dupKeyValue2 & "'"
    FX_adodbRecordset="ADODB.Recordset"
    set FX_rsKey=Server.CreateObject(FX_adodbRecordset)
    FX_rsKey.ActiveConnection=FX_rsKeyConnection
    FX_rsKey.Source=FX_dupKeySQL
    FX_rsKey.CursorType=0
    FX_rsKey.CursorLocation=2
    FX_rsKey.LockType=3
    FX_rsKey.Open
    If ((Not FX_rsKey.EOF Or Not FX_rsKey.BOF)) Then
    ' this value was found - can not execute action
    FX_found = true
    FX_dupValue = "NomeAtleta (" & FX_dupKeyValue & ") " &
    "CognomeAtleta (" & FX_dupKeyValue2 & ") "
    End If
    if(FX_found) Then
    FX_dupValue = FX_dupValue & "already exists!"
    FX_qsChar = "?"
    If (InStr(1,FX_dupKeyRedirect,"?") >= 1) Then FX_qsChar = "&"
    FX_dupKeyRedirect = FX_dupKeyRedirect & FX_qsChar & "FX_ReqValue="
    & Server.URLEncode(FX_dupValue)
    Response.Redirect(FX_dupKeyRedirect)
    End If
    FX_rsKey.Close
    End If
    %>


    <%
    Session("FX_checkvalue") = ""
    Session("FX_checkvalue2") = ""
    %>

    potete aiutarmi?? o consigliarmi un'altro codice?
    grazie

  2. #2
    fare la minima fatica di almeno evidenziare le righe che danno errore, no, eh?

  3. #3
    <% ' *** Check New Elements
    FX_flag="MM_insert"
    FX_rs = "" ' used for identification
    FX_found = false
    If (CStr(Request(FX_flag)) <> "") Then
    FX_dupKeyRedirect="esiste_atleta.asp"
    FX_rsKeyConnection=MM_ConnUtentiAmm_STRING
    FX_dupKeyValue = CStr(Request.Form("Link"))

    FX_dupKeySQL="SELECT cadLink FROM tblQCAds WHERE cadLink = '"&
    FX_dupKeyValue & "'AND '" & FX_dupKeyValue2 & "'"
    FX_adodbRecordset="ADODB.Recordset"
    set FX_rsKey=Server.CreateObject(FX_adodbRecordset)
    FX_rsKey.ActiveConnection=FX_rsKeyConnection
    FX_rsKey.Source=FX_dupKeySQL
    FX_rsKey.CursorType=0
    FX_rsKey.CursorLocation=2
    FX_rsKey.LockType=3
    FX_rsKey.Open
    If ((Not FX_rsKey.EOF Or Not FX_rsKey.BOF)) Then
    ' this value was found - can not execute action
    FX_found = true
    FX_dupValue = "NomeAtleta (" & FX_dupKeyValue & ") " &
    "CognomeAtleta (" & FX_dupKeyValue2 & ") "
    End If
    if(FX_found) Then
    FX_dupValue = FX_dupValue & "already exists!"
    FX_qsChar = "?"
    If (InStr(1,FX_dupKeyRedirect,"?") >= 1) Then FX_qsChar = "&"
    FX_dupKeyRedirect = FX_dupKeyRedirect & FX_qsChar & "FX_ReqValue="
    & Server.URLEncode(FX_dupValue)
    Response.Redirect(FX_dupKeyRedirect)
    End If
    FX_rsKey.Close
    End If
    %>


    <%
    Session("FX_checkvalue") = ""
    Session("FX_checkvalue2") = ""
    %>

    ho messo in rosso la lettera che mi da errore

  4. #4
    in asp le istruzioni vanno tutte su una riga. se vuoi spezzare devi mettere il segno _

    a = b & c & d

    oppure

    a = b & _
    c & d



  5. #5
    grazie,,
    l'errore non c'è più ma il codice non funziona!! avete qualcosa da proporre?

  6. #6
    Originariamente inviato da fabiusriders
    grazie,,
    l'errore non c'è più ma il codice non funziona!! avete qualcosa da proporre?
    certo, sistema il codice e vedrai che funziona

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.