troubleshooting Question

Add access dbase to DataGridView VB.net

Avatar of Wilder1626
Wilder1626Flag for Canada asked on
Visual Basic.NET
2 Comments1 Solution514 ViewsLast Modified:
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)

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
ASKER CERTIFIED SOLUTION
tumtum73

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 1 Answer and 2 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 2 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros