Erreur de syntaxe dans l'instruction INSERT INTO.
Private Sub Load_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load affichetoussortie() Try FileOpen(1, "c:/materiel.txt", OpenMode.Input) Do nom(i) = LineInput(1) Me.ComboBoxmateriel.Items.Add(nom(i)) Loop Until EOF(1) FileClose() Catch ex As Exception End Try End Sub
Public Sub affichetoussortie() connexion "Provider Microsoft.ACE.OLEDB.12.0;Data Source=" & Application.StartupPath & "/" & "sortiebd.accdb;" connexionOLE.ConnectionString = connexion connexionOLE.Open() da = New OleDbDataAdapter("select * from sortiebd", connexionOLE) ds = New DataSet da.Fill(ds, "sortiebd") dv = ds.Tables("sortiebd").DefaultView connexionOLE.Close() dv.AllowEdit = True Dim Matable As DataTable Matable = ds.Tables("sortiebd") Me.DataGridViewsortie.DataSource = Matable End Sub
Erreur de syntaxe dans l'instruction INSERT INTO.
Vous n’avez pas trouvé la réponse que vous recherchez ?
Posez votre questionda.InsertCommand = New OleDb.OleDbCommand("INSERT INTO sortiebd (0,) values ('" & Me.TextBoxlieusortie.Text.ToString & "')", connexionOLE)
Private Sub Buttonajoutersortie_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Buttonajoutersortie.Click Dim Newligne As DataRow = ds.Tables("sortiebd").NewRow() connexionOLE.ConnectionString = connexion connexion "Provider Microsoft.ACE.OLEDB.12.0;Data Source=" & Application.StartupPath & "/" & "sortiebd.accdb" connexionOLE.Open() Newligne(0) = Me.TextBoxlieusortie.Text.ToString Newligne(1) = Me.MaskedTextBoxdatesortie.Text.ToString Newligne(2) = Me.MaskedTextBoxheure.Text.ToString Newligne(3) = Me.ComboBoxafaire.SelectedText.ToString ds.Tables("sortiebd").Rows.Add(Newligne) Try cb = New OleDbCommandBuilder(da) 'Nouvelle ligne da.UpdateCommand = cb.GetUpdateCommand(Command.ToString) da.Update(ds, "sortiebd") ds.Clear() da.Fill(ds, "sortiebd") Dim Matable As DataTable Matable = ds.Tables("sortiebd") connexionOLE.Close() Catch End Try End Sub
Private Sub Buttonajoutersortie_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Buttonajoutersortie.Click Dim Newligne As DataRow = ds.Tables("sortiebd").NewRow() connexionOLE.ConnectionString = connexion connexion "Provider Microsoft.ACE.OLEDB.12.0;Data Source=" & Application.StartupPath & "/" & "sortiebd.accdb" connexionOLE.Open() Newligne(0) = Me.TextBoxlieusortie.Text.ToString Newligne(1) = Me.MaskedTextBoxdatesortie.Text.ToString Newligne(2) = Me.MaskedTextBoxheure.Text.ToString Newligne(3) = Me.ComboBoxafaire.SelectedText.ToString ds.Tables("sortiebd").Rows.Add(Newligne) Try cb = New OleDbCommandBuilder(da) 'Nouvelle ligne da.UpdateCommand = cb.GetUpdateCommand(Command.ToString) da.Update(ds, "sortiebd") ds.Clear() da.Fill(ds, "sortiebd") Dim Matable As DataTable Matable = ds.Tables("sortiebd") connexionOLE.Close() Catch End Try End Sub