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

    Modificare un record dopo averlo cuccato

    E' possibile aggiornare un campo di un database, dopo aver fatto una verifica?
    ad esempio, nel seguente codice prima vedo se la mia variabile "codicegame" è uguale a quella presente nel campo "codicegioco", dopodichè vorrei cambiare qualche campo nello stesso record...che codice ci metto??



    Dim myConnection, myRS, ok
    Set myConnection = Server.CreateObject("ADODB.Connection")
    myConnection.connectionstring = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath("rece/"&piattaformagame&"/database.mdb")& ";"
    myConnection.Open

    Set myRS = Server.CreateObject("ADODB.Recordset")
    myRS.Open "SELECT * FROM giochi", myConnection


    Do While Not myRS.EOF

    IF StrComp(myRS.Fields("codicegioco"), codicegame, vbTextCompare) = 0 THEN




    ??? UPDATE DI ALCUNI CAMPI DEL RECORD ???




    END IF
    myRS.MoveNext()

    Loop

    myRS.Close
    Set myRS=Nothing
    myConnection.Close
    Set myConnection=Nothing
    Where there is a will, there is a way

  2. #2
    Utente di HTML.it L'avatar di agenti
    Registrato dal
    Feb 2002
    Messaggi
    2,427
    sql="UPDATE MIA_TAB SET tuo_campo = 'testo' , tuo_campo1 = "&numerico&" where .... "
    conn.execute (sql)

  3. #3
    Niente da fare. Il codice che stò usando adesso è questo:

    Dim myConnection, myRS, ok
    Set myConnection = Server.CreateObject("ADODB.Connection")

    myConnection.connectionstring = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath("rece/"&piattaformagame&"/database.mdb")& ";"
    myConnection.Open

    sql = "UPDATE giochi SET sviluppatore='sviluppatoregame', WHERE codicegioco='codicegioco'"

    myConnection.Execute (sql)
    myConnection.Close
    Set myConnection=Nothing




    mi da questo errore:

    Microsoft JET Database Engine error '80040e14'
    Syntax error in UPDATE statement.
    /modificarticolo.asp, line 145

    Nota:codicegioco è un campo di testo
    Where there is a will, there is a way

  4. #4
    risolto, era piena di errori la UPDATE
    Where there is a will, there is a way

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.