Ajouter des données à une BD access avec vb-net 2012

couretjp Messages postés 8 Date d'inscription jeudi 4 juillet 2002 Statut Membre Dernière intervention 26 septembre 2019 - 26 sept. 2019 à 12:04
couretjp Messages postés 8 Date d'inscription jeudi 4 juillet 2002 Statut Membre Dernière intervention 26 septembre 2019 - 26 sept. 2019 à 16:16
Bonjour,

Je e suis pas programmeur, je suis un très petit amateur qui veut créer un programme de gestion de timbre.
J'ai ce code, je pense qu'il n'y as pas d'erreur au test, mais rien ne ce passe quand je clique sur le bouton
Je pense qu'il manque quelque chose, mais quoi?

Voici mon code:

Imports System.Data
Imports System.Data.OleDb
Public Class Form1

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Try
Dim SavInto As New OleDb.OleDbCommand
Dim ConStr As String = _
"Provider=Microsoft.Jet.OLEDB.4.0; Data Source =" & _
Application.StartupPath & "\supplément SG.mdb"
Dim Conn As New OleDbConnection(ConStr)
SavInto.Connection = Conn
SavInto.CommandType = CommandType.Text
SavInto.CommandText = "INSERT INTO Principale(N° spc,N° SG,Val,Coul,Type,Perf,U,Code,Band,Paper/Gum,Date,Print,Date suppl)values ('" & TextBox1.Text & "','" & TextBox2.Text & "','" & TextBox3.Text & "','" & TextBox4.Text & "', '" & TextBox5.Text & "','" & ComboBox1.Text & "','" & TextBox6.Text & "','" & TextBox7.Text & "', '" & ComboBox2.Text & "','" & TextBox9.Text & "','" & ComboBox3.Text & "','" & TextBox10.Text & "') "
Conn.Open()
SavInto.ExecuteNonQuery()
Conn.Close()
MsgBox("Données ajoutées avec succés")

Catch ex As Exception
Exit Sub
End Try
TextBox1.Text = ""
TextBox2.Text = ""
TextBox3.Text = ""
TextBox4.Text = ""
TextBox5.Text = ""
TextBox6.Text = ""
TextBox7.Text = ""
TextBox8.Text = ""
TextBox9.Text = ""
TextBox10.Text = ""


End Sub
End Class

Merci de par avance.

2 réponses

cs_Le Pivert Messages postés 7903 Date d'inscription jeudi 13 septembre 2007 Statut Contributeur Dernière intervention 11 mars 2024 137
Modifié le 26 sept. 2019 à 15:46
0
couretjp Messages postés 8 Date d'inscription jeudi 4 juillet 2002 Statut Membre Dernière intervention 26 septembre 2019
26 sept. 2019 à 16:16
Merci, c'est bien, mais très difficile, il vas me falloir quelques jours pour y arriver.
0
Rejoignez-nous