Non riesco veramente a capire, ho fatto una insert into sotto e tutto funziona correttamente.![]()
Perchè la insert into la tabella utenti non funziona'? L'ho scritta allo stesso modo.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" Rem sql = "INSERT INTO utenti (username, password) VALUES ('entrata', 'miao')" Rem cn.Execute (sql) Rem id_utente = rs(id_utente).value sql = "INSERT INTO conto_corrente (id_conto, nome, cognome, banca, saldo, id_utente) VALUES ('" & txt_conto.Text & "', '" & txt_nome.Text & "', '" & txt_cogn.Text & "' , '" & txt_banca.Text & "', '" & txt_saldo.Text & "', '1')" cn.Execute (sql) 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
La tabella utenti è così composta:
id_utente ( contatore chiave principale)
username
password

Rispondi quotando