Add access dbase to DataGridView VB.net

Hello all

I'm trying it insert data from my Access DBase into my DataGridView, based on some column.

The problem is on that part of the code:
 Me.sauvegarde.AddItem(oRST2("Client") & vbTab & (oRST2("Telephone")) & vbTab & oRST2("Type_Boisson") & vbTab & oRST2("No_Lot") & vbTab & oRST2("Date_Depart") & vbTab & oRST2("Date_Soutirage") & vbTab & oRST2("Date_Stabilisation") & vbTab & oRST2("Date_Filtration") & vbTab & oRST2("Date_Embouteillage") & vbTab & oRST2("Genre_Boisson") & vbTab & oRST2("Notes") & vbTab)

Open in new window


It say Additem is not a member of System.Windows.Forms.DataGridView.

Can you help me with This please?

Thanks again for your help.


Option Explicit On
Imports Microsoft.Office.Interop
Imports System.Reflection
Imports Microsoft.Office.Interop.Access



  Dim sSQL2 As String
        Dim oRST2 As ADODB.Recordset
        oRST2 = New ADODB.Recordset
        Dim oConnect2 As ADODB.Connection
        oConnect2 = New ADODB.Connection


        oConnect2.Open("Provider=Microsoft.ACE.OLEDB.12.0;" & _
         "Data Source=" & Form4.base_de_donnee.Text)


        sSQL2 = "SELECT [Client],[Telephone],[Type_Boisson],[No_Lot],[Date_Depart],[Date_Soutirage],[Date_Stabilisation],[Date_Filtration],[Date_Embouteillage],[Genre_Boisson],[Notes] FROM [DBase_Vignoble] Where " _
        & "Date_Depart => '" & DateTimePicker1.Text & "' OR " _
         & "Date_Depart =< '" & DateTimePicker2.Text & "'"

        sSQL2 = sSQL2 & " ORDER BY [Date_Depart]"

        oRST2.Open(sSQL2, oConnect2)

        If oRST2.BOF = False Then

            Do Until oRST2.EOF
                Me.sauvegarde.AddItem(oRST2("Client") & vbTab & (oRST2("Telephone")) & vbTab & oRST2("Type_Boisson") & vbTab & oRST2("No_Lot") & vbTab & oRST2("Date_Depart") & vbTab & oRST2("Date_Soutirage") & vbTab & oRST2("Date_Stabilisation") & vbTab & oRST2("Date_Filtration") & vbTab & oRST2("Date_Embouteillage") & vbTab & oRST2("Genre_Boisson") & vbTab & oRST2("Notes") & vbTab)
                oRST2.MoveNext()
            Loop

        End If
    End Sub

Open in new window

LVL 11
Wilder1626Asked:
Who is Participating?
 
tumtum73Connect With a Mentor Commented:
I believe you need to use the "Me.sauvegarde.Rows.Add()" function on line 30.

Please see the MSDN reference located at:

http://msdn.microsoft.com/en-us/library/system.windows.forms.datagridview.aspx#Y228
0
 
Wilder1626Author Commented:
Thanks for your help.

That was not to hard to fix, but very simple.

Thanks
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.