Avatar of Wilder1626
Wilder1626
Flag for Canada asked on

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

Visual Basic.NET

Avatar of undefined
Last Comment
Wilder1626

8/22/2022 - Mon
ASKER CERTIFIED SOLUTION
tumtum73

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question
Wilder1626

ASKER
Thanks for your help.

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

Thanks
All of life is about relationships, and EE has made a viirtual community a real community. It lifts everyone's boat
William Peck