Bonjour, j'ai une table access et j'utilise VB.

Je veux envoyer des informations comprises dans des textboxs dans ma base ACCESS:


Mon code:

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
Imports System
Imports System.Data
Imports System.Data.OleDb
 
Public Class Form4
    Dim cn As New OleDbConnection
    Dim Obj_Command As New OleDbCommand
 
    Private Sub Form4_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
 
        cn.ConnectionString = "Provider=Microsoft.JET.OLEDB.4.0;Data Source='C:\Users\Samuel\Desktop\BASE.mdb';"
        cn.Open()
    End Sub
 
    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
        If cn.State = ConnectionState.Open Then
            MsgBox("connecté avec succès", MsgBoxStyle.Information)
        End If
    End Sub
 
    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
 
        Obj_Command.Connection = cn
        Obj_Command.CommandText = "INSERT INTO MEMBRES (ID_MEMBRE, PRENOM) VALUES('" & TextBox_ID.Text & "' ,'" & TextBox_prenom.Text & "')"
        Obj_Command.ExecuteNonQuery()
 
    End Sub
MESSAGE D'ERREUR:
L'instruction INSERT INTO contient le nom de champ inconnu suivant : 'ID_MEMBRE'. Assurez-vous que vous avez correctement saisi le nom, puis recommencez l'opération.
pourtant le nom correspond bien à celui que j'ai donné dans ma table
et le lien fonction car mon button_2 me retourne bien que la connexion est ouverte.

Quelqu'un pourrait il m'aider.

En vous remerciant.

Samuel.