Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

Dim utente As String = TextBox1.Text
If String.IsNullOrEmpty(utente) Then
MessageBox.Show("Devi inserire un utente")
TextBox1.Focus()
Exit Sub
End If

Dim m_StrConn As String="Provider=Microsoft.Jet.OLEDB.4.0;DataSourc e=C:\Documentsand Settings\enzo.ENZO-59B7B5DDEE\Documenti\Visual Studio 2005\Projects\prova\prova\Db1.mdb;Persist Security Info=False"
Dim vConn As New OleDbConnection(m_StrConn)
vConn.Open()
Try
Dim vComm As New OleDbCommand("INSERT INTO UTENTI(Utente,Password) VALUES (?,?)", vConn)
' Definisce i parametri del comando
Dim MyParam As OleDbParameter
' Valorizza il parametro con il nome dell'utente
MyParam = New OleDbParameter("Utente", OleDbType.VarChar, 50)
MyParam.Value = utente
vComm.Parameters.Add(MyParam)
' Valorizza il parametro con la password
MyParam = New OleDbParameter("Password", OleDbType.VarChar, 32)
MyParam.Value = "ciao"
vComm.Parameters.Add(MyParam)


vComm.ExecuteNonQuery()
Catch ex As Exception
MessageBox.Show(ex.ToString, "Errore di accesso ai dati")

End Try



End Sub