Dim Cmd as OleDb.OleDbCommand Private Sub Form_Load(...) Dim cnx As OleDb.OleDbConnection = Nothing Dim cmd As OleDb.OleDbCommand cnx = Open_connexion() cmd = New OleDb.OleDbCommand cmd.CommandType = CommandType.Text Dim sql As String = "INSERT INTO UTILISATEUR (identifiant, mdp, question, reponse) VALUES (@login, @password, @question, @reponse)" cmd.CommandText = sql cmd.Parameters.Add("@login") 'ajouter options nature paramètre cmd.Parameters.Add("@password") cmd.Parameters.Add("@question") cmd.Parameters.Add("@reponse") cmd.Connection = cnx End Sub Public Sub Ajouter(ByVal NewUser As USER) cmd.Parameters("@login").value = NewUser.Login cmd.Parameters("@password").value = NewUser.Password cmd.Parameters("@question").value = NewUser.Question cmd.Parameters("@reponse").value = NewUser.Reponse cmd.ExecuteNonQuery() End Sub
Private Sub Form_Load(...) Dim cnx As OleDb.OleDbConnection = Nothing cnx = Open_connexion() cmd = New OleDb.OleDbCommand cmd.CommandType = CommandType.Text Dim sql As String = "INSERT INTO UTILISATEUR (identifiant, mdp, question, reponse) VALUES (@login, @password, @question, @reponse)" cmd.CommandText = sql cmd.Parameters.Add("@login") 'ajouter options nature paramètre cmd.Parameters.Add("@password") cmd.Parameters.Add("@question") cmd.Parameters.Add("@reponse") cmd.Connection = cnx End Sub
Vous n’avez pas trouvé la réponse que vous recherchez ?
Posez votre question