Fasyrio (Normal User)
Newbie
Messaggi: 2
Iscritto: 22/02/2010
|
Ciao a tutti ho un problema con questo errore di compilazione, pare che l'istruziona SQL contenga troppi campi. Potreste gentilmente aiutarmi a risolvere questo problema postadomi il codice corretto sia per l'insert che per l'update?
Premetto che uso Visual Basic 6 con un archivi access .mdb, vi incollo l'intera istruzione.
Grazie mille per la collaborazione!
Codice:
If cmbseleziona.Text = "" Then
SQL = "INSERT INTO utenti " _
& "(nome, cognome, indirizzo, mansione, data_nascita, liv_cat, data_assunzione,citta, provincia, titolo_studio, telefono, diplomi, esperienze, check1, check2, check3, check4, check5, check6, check7, check8, check9, check10) " _
& "VALUES " _
& "('" & Replace(txtnome.Text, "'", "''") & "', " _
& "'" & Replace(txtcognome.Text, "'", "''") & "', " _
& "'" & Replace(txtindirizzo.Text, "'", "''") & "', " _
& "'" & Replace(txtmansione.Text, "'", "''") & "', " _
& "'" & Replace(txtdata_nascita.Text, "'", "''") & "', " _
& "'" & Replace(txtliv_cat.Text, "'", "''") & "', " _
& "'" & Replace(txtdata_assunzione.Text, "'", "''") & "', " _
& "'" & Replace(txtcitta.Text, "'", "''") & "', " _
& "'" & Replace(txtprovincia.Text, "'", "''") & "', " _
& "'" & Replace(txttitolo_studio.Text, "'", "''") & "', " _
& "'" & Replace(txttelefono.Text, "'", "''") & "', " _
& "'" & Replace(txtdiplomi.Text, "'", "''") & "', " _
& "'" & Replace(txtesperienze.Text, "'", "''") & "', " _
& "'" & Replace(txtcheck1.Text, "'", "''") & "', " _
& "'" & Replace(txtcheck2.Text, "'", "''") & "', " _
& "'" & Replace(txtcheck3.Text, "'", "''") & "', " _
& "'" & Replace(txtcheck4.Text, "'", "''") & "', " _
& "'" & Replace(txtcheck5.Text, "'", "''") & "', " _
& "'" & Replace(txtcheck6.Text, "'", "''") & "', " _
& "'" & Replace(txtcheck7.Text, "'", "''") & "', " _
& "'" & Replace(txtcheck8.Text, "'", "''") & "', " _
& "'" & Replace(txtcheck9.Text, "'", "''") & "', "
& "'" & Replace(txtcheck10.Text, "'", "''") & "')"
MsgBox "Inserimento Effettuato con successo", 64, "Info"
Else
SQL = "UPDATE utenti SET " _
& "nome = '" & Replace(txtnome.Text, "'", "''") & "', " _
& "cognome = '" & Replace(txtcognome.Text, "'", "''") & "', " _
& "indirizzo = '" & Replace(txtindirizzo.Text, "'", "''") & "', " _
& "mansione = '" & Replace(txtmansione.Text, "'", "''") & "', " _
& "data_nascita = '" & Replace(txtdata_nascita.Text, "'", "''") & "', " _
& "liv_cat = '" & Replace(txtliv_cat.Text, "'", "''") & "', " _
& "data_assunzione = '" & Replace(txtdata_assunzione.Text, "'", "''") & "', " _
& "citta = '" & Replace(txtcitta.Text, "'", "''") & "', " _
& "provincia = '" & Replace(txtprovincia.Text, "'", "''") & "', " _
& "titolo_studio = '" & Replace(txttitolo_studio.Text, "'", "''") & "', " _
& "telefono = '" & Replace(txttelefono.Text, "'", "''") & "', " _
& "diplomi = '" & Replace(txtdiplomi.Text, "'", "''") & "', " _
& "esperienze = '" & Replace(txtesperienze.Text, "'", "''") & "', " _
& "check1 = '" & Replace(txtcheck1.Text, "'", "''") & "', " _
& "check2 = '" & Replace(txtcheck2.Text, "'", "''") & "', " _
& "check3 = '" & Replace(txtcheck3.Text, "'", "''") & "', " _
& "check4 = '" & Replace(txtcheck4.Text, "'", "''") & "', " _
& "check5 = '" & Replace(txtcheck5.Text, "'", "''") & "', " _
& "check6 = '" & Replace(txtcheck6.Text, "'", "''") & "', " _
& "check7 = '" & Replace(txtcheck7.Text, "'", "''") & "', " _
& "check8 = '" & Replace(txtcheck8.Text, "'", "''") & "' " _
& "check9 = '" & Replace(txtcheck9.Text, "'", "''") & "' " _
& "check10 = '" & Replace(txtcheck10.Text, "'", "''") & "' " _
& "WHERE id = " & CInt(s(0))
MsgBox "Modifica effettuata con successo", 64, "Info"
End If
|