Ciao a tutti. vi riport il sorgente, ho uno strano problema con la INSERT INTO.
L'errore è che la sintassi INSERT INTO è errata. Allora sono andato in debug ho visto il contenuto della sql ed è questo: "INSERT INTO utenti (username,password) VALUES ('miciomicio', 'baobao')"codice:If txt_username.Text <> "" And txt_pass.Text <> "" And txt_ripass.Text <> "" And txt_nome.Text <> "" And txt_cogn.Text <> "" And txt_conto.Text <> "" And txt_saldo.Text <> "" Then If txt_pass.Text = txt_ripass.Text Then If IsNumeric(txt_conto.Text) And IsNumeric(txt_saldo.Text) Then Set cn = New ADODB.Connection Set rs = New ADODB.Recordset cn.CursorLocation = adUseClient cn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=database\conto_corrente.mdb;Persist Security Info=False" sql = "INSERT INTO utenti (username, password) VALUES ('" & txt_username.Text & "', '" & txt_pass.Text & "')" Set rs = cn.Execute(sql) id_utente = rs(id_utente).value ElseIf IsNumeric(txt_conto.Text) = False Then MsgBox "Numero di conto non valido", vbOKOnly + vbExclamation + vbDefaultButton1, "Errore" Else MsgBox "Importo non valido", vbOKOnly + vbExclamation + vbDefaultButton1, "Errore" End If Else MsgBox "Le password inserite sono diverse", vbOKOnly + vbExclamation + vbDefaultButton1, "Errore" txt_pass.Text = "" txt_ripass.Text = "" End If Else MsgBox "Compilare tutti i campi", vbOKOnly + vbExclamation + vbDefaultButton1, "Errore" End If
Ho preso il contenuto sono andato in access ho fatto una query con quella insert into e mi funziona!!![]()
Sempre nello stesso programma ho usato la insert into e mi funziona senza problemi.
Dove sbaglio?
Grazie

Rispondi quotando