Bonjour,

Comme apparemment je me suis mal expliqué je reformule mon problème.
Je n'arrive pas à envoyer mes données dans ma base de données MySQL cela m'affiche une erreur que voici:
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
 
 
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '[cleidentification].[cleidentification] ([processeur], [bios], [cartevideo], [di' at line 1
 
Link
 
 
StackTrace
 
   à System.Data.Common.DbDataAdapter.UpdatedRowStatusErrors(RowUpdatedEventArgs rowUpdatedEvent, BatchCommandInfo[] batchCommands, Int32 commandCount)
   à System.Data.Common.DbDataAdapter.UpdatedRowStatus(RowUpdatedEventArgs rowUpdatedEvent, BatchCommandInfo[] batchCommands, Int32 commandCount)
   à System.Data.Common.DbDataAdapter.Update(DataRow[] dataRows, DataTableMapping tableMapping)
   à System.Data.Common.DbDataAdapter.UpdateFromDataTable(DataTable dataTable, DataTableMapping tableMapping)
   à System.Data.Common.DbDataAdapter.Update(DataSet dataSet, String srcTable)

Ceci ce produit à la ligne 30 de 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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
 
#Region "Base Generateur*******************"
    Public DataAdapterIdPC As MySqlDataAdapter = New MySqlDataAdapter()
    Dim CmdBuildIdPC As MySqlCommandBuilder = New MySqlCommandBuilder(DataAdapterIdPC)
    Public DataSetIdPC As DataSet = New DataSet("cleidentification")
 
    Private Sub ChargerBaseIdPC()
 
        Try
            CmdBuildIdPC.QuotePrefix = "["
            CmdBuildIdPC.QuoteSuffix = "]"
        Catch : End Try
 
        If DataSetIdPC.Tables("cleidentification") IsNot Nothing Then
            If Application.OpenForms.Count > 3 And Rechargement = False Then Exit Sub
            DataSetIdPC.Tables("cleidentification").Clear()
        End If
        Dim Req As String
        Dim Cmd As MySqlCommand
        Req = "SELECT * FROM cleidentification"
        Cmd = New MySqlCommand(Req, CnxIdPC) 'recup les données de Mysql
        DataAdapterIdPC.SelectCommand = Cmd ' DataAdaptater fait la laison entre le dataset et Mysql 
        DataAdapterIdPC.Fill(DataSetIdPC, "cleidentification") 'le Fill permet d'extraire les données du Dataset et les mettres dans la datatable "cleidentification"
    End Sub
    Sub MAJIdPC()
 
        If DataSetIdPC.Tables("cleidentification") IsNot Nothing Then
            If DataSetIdPC.Tables("cleidentification").GetChanges Is Nothing Then Exit Sub
MAJ:        Try
                CmdBuildIdPC.GetUpdateCommand()
                DataAdapterIdPC.Update(DataSetIdPC, "cleidentification") 'Repercute sur La table mysql les données modifié dans le dataset ''''Contient le dataset avec les données modif et l'objet datatable qui contient les modif a extraire
                Rechargement = True : ChargerBaseIdPC() : Rechargement = False
            Catch ex As Exception
                If ErreurMAJBases = False Then ErreurMAJBases = True : GoTo MAJ
 
 
                TextBox1.Text = ex.Message & vbCrLf & vbCrLf & "Link" & vbCrLf & ex.HelpLink & vbCrLf & vbCrLf & "StackTrace" & vbCrLf & vbCrLf & ex.StackTrace & vbCrLf & vbCrLf & "Source" & vbCrLf & vbCrLf & ex.Source
                MsgBox("Erreur message : " & vbCrLf & ex.Message & vbCrLf & vbCrLf & "Link" & vbCrLf & ex.HelpLink & vbCrLf & vbCrLf & "StackTrace" & vbCrLf & vbCrLf & ex.StackTrace & vbCrLf & vbCrLf & "Source" & vbCrLf & vbCrLf & ex.Source, MsgBoxStyle.Critical, "Critique")
 
                ErreurMAJBases = False
            End Try
        End If
    End Sub
#End Region
#Region "Affiche données*******************"
    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        With Me.DataGrid1
            .RowsDefaultCellStyle.BackColor = Color.White
            .AlternatingRowsDefaultCellStyle.BackColor = Color.AliceBlue
        End With
        RecupDonnées()
        ConnexionIdPC()
        ChargerBaseIdPC()
 
        DataGrid1.DataSource = DataSetIdPC.Tables("cleidentification")
    End Sub
#End Region
#Region "Enregistrement********************"
    Private Sub BT_Envoyer_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BT_Envoyer.Click
 
        Dim MyNewRow As DataRow = DataSetIdPC.Tables("cleidentification").NewRow
        Try
            MyNewRow("processeur") = TB_cléProc2.Text
            MyNewRow("bios") = TB_cléBIOS2.Text
            MyNewRow("cartevideo") = TB_cléCG2.Text
            MyNewRow("disquedur") = TB_cléDD2.Text
            DataSetIdPC.Tables("cleidentification").Rows.Add(MyNewRow)
 
            MAJIdPC()
 
        Catch err As Exception
            MsgBox(err.Message & "error")
            DataSetIdPC = New DataSet
            DataAdapterIdPC = New MySqlDataAdapter("SELECT * FROM cleidentification", CnxIdPC)
            DataAdapterIdPC.Fill(DataSetIdPC, "cleidentification")
            DataGrid1.DataSource = DataSetIdPC.Tables("cleidentification")
            Exit Sub
        End Try
    End Sub
#End Region
Voici ma base de donnée au cas ou (j'ai utilisé un export donc faites pas attention à la syntaxe c'est pour que vous voyez sa structure) :
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
28
29
30
31
32
33
 
 
-- phpMyAdmin SQL Dump
-- version 3.1.1
-- http://www.phpmyadmin.net
--
-- Serveur: localhost
-- Généré le : Jeu 15 Janvier 2009 à 16:01
-- Version du serveur: 5.1.30
-- Version de PHP: 5.2.8
 
SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO";
 
--
-- Base de données: `cleidentification`
--
 
-- --------------------------------------------------------
 
--
-- Structure de la table `cleidentification`
--
 
CREATE TABLE IF NOT EXISTS `cleidentification` (
  `Code` int(11) NOT NULL AUTO_INCREMENT,
  `processeur` varchar(4) CHARACTER SET latin1 DEFAULT NULL,
  `bios` varchar(4) CHARACTER SET latin1 DEFAULT NULL,
  `cartevideo` varchar(4) CHARACTER SET latin1 DEFAULT NULL,
  `disquedur` varchar(4) CHARACTER SET latin1 DEFAULT NULL,
  PRIMARY KEY (`Code`)
) ENGINE=MyISAM  DEFAULT CHARSET=utf8 AUTO_INCREMENT=55566 ;
 
--

Si quelqu'un voit ou mon code n'est pas bon ?


merci d'avance