Questo sito utilizza cookies solo per scopi di autenticazione sul sito e nient'altro. Nessuna informazione personale viene tracciata. Leggi l'informativa sui cookies.
Username: Password: oppure
Visual Basic 6 - Errore in VB6: Too many long continuations
Forum - Visual Basic 6 - Errore in VB6: Too many long continuations

Avatar
Fasyrio (Normal User)
Newbie


Messaggi: 2
Iscritto: 22/02/2010

Segnala al moderatore
Postato alle 12:03
Lunedì, 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

PM Quote
Avatar
Alfonso (Ex-Member)
Guru


Messaggi: 688
Iscritto: 30/09/2009

Segnala al moderatore
Postato alle 16:45
Lunedì, 22/02/2010
Mi sembra che sia solo la parte dell'insert che dà problemi.
Potresti incominciare togliendo un po' di concatenazioni.
Codice sorgente - presumibilmente Plain Text

  1. & "VALUES " _
  2. & "('" & Replace(txtnome.Text, "'", "''") & "', " _
  3. & "'" & Replace(txtcognome.Text, "'", "''") & "', " _
  4. & "'" & Replace(txtindirizzo.Text, "'", "''") & "', " _


Diventa
Codice sorgente - presumibilmente Plain Text

  1. & "VALUES (" _
  2. & Replace(txtnome.Text, "'", "''") & "', '" _
  3. & Replace(txtcognome.Text, "'", "''") & "', '" _
  4. & Replace(txtindirizzo.Text, "'", "''") & "', '" _


e così via

PM Quote
Avatar
GrG (Member)
Guru^2


Messaggi: 3430
Iscritto: 21/08/2007

Segnala al moderatore
Postato alle 16:51
Lunedì, 22/02/2010
come dice anche l'errore stesso secondo me hai messo troppi "accapo" nel codice, intendo troppi:
codice _
& codice _
& ...

cerca di levare un pò di "continuazioni" mettendo più codice per ogni riga

PM Quote
Avatar
nessuno (Normal User)
Guru^2


Messaggi: 6404
Iscritto: 03/01/2010

Segnala al moderatore
Postato alle 20:22
Lunedì, 22/02/2010
Modifica questa così

& "(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 " _

e aggiungi il _ in

& "'" & Replace(txtcheck9.Text, "'", "''") & "', " _

P.S. Ma vedo che hai già ottenuto aiuto in http://forum.masterdrive.it/visual-basic-6-17/errore-vb6-t ...

Ultima modifica effettuata da nessuno il 22/02/2010 alle 20:38


Ricorda che nessuno è obbligato a risponderti e che nessuno è perfetto ...
---
Il grande studioso italiano Bruno de Finetti ( uno dei padri fondatori del moderno Calcolo delle probabilità ) chiamava il gioco del Lotto Tassa sulla stupidità.
PM Quote
Avatar
Fasyrio (Normal User)
Newbie


Messaggi: 2
Iscritto: 22/02/2010

Segnala al moderatore
Postato alle 9:13
Giovedì, 25/02/2010
Grazie mille per l'aiuto!

PM Quote