1,105,288 Community Members

Data grid view loading multiple time.I want only one time loading

Member Avatar
sachintha
Newbie Poster
1 post since Sep 2013
Reputation Points: 0 [?]
Q&As Helped to Solve: 0 [?]
Skill Endorsements: 0 [?]
 
0
 

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

 myconnection = New OleDbConnection("provider=microsoft.ACE.OLEDB.12.0;data source=C:\Users\DELL\Documents\Visual Studio 2012\Projects\WindowsApplication9\WindowsApplication9\NIBM.accdb")



    myAdapter = New OleDbDataAdapter("select*from Driverdetails", myconnection)

    myAdapter.Fill(Ds, "Driverdetails")
    myconnection.Close()
    DataGridView1.DataSource = Ds
    DataGridView1.DataMember = "Driverdetails"



End Sub
Member Avatar
kRod
Junior Poster
139 posts since May 2012
Reputation Points: 49 [?]
Q&As Helped to Solve: 35 [?]
Skill Endorsements: 6 [?]
 
0
 
 myconnection = New OleDbConnection("provider=microsoft.ACE.OLEDB.12.0;data source=C:\Users\DELL\Documents\Visual Studio 2012\Projects\WindowsApplication9\WindowsApplication9\NIBM.accdb")



    myAdapter = New OleDbDataAdapter("select*from Driverdetails", myconnection)

    myAdapter.Fill(Ds, "Driverdetails")
    myconnection.Close()
   ** DataGridView1.DataSource = Ds.Tables(tableName or index)**
    DataGridView1.DataMember = "Driverdetails"



End Sub

You need to Set the DataSource of the DataGridView to a particular table of the dataset

You
This article has been dead for over three months: Start a new discussion instead
Post:
Start New Discussion
View similar articles that have also been tagged: