i am trying to populate a datagridview from an ms access database with this code but it doesnt works. what is going wrong ?

Dim con As OleDbConnection = New OleDbConnection("Provider=Microsoft.jet.oledb.4.0;data source=unclp.mdb;")

Dim cmd As OleDbCommand = New OleDbCommand("Select * FROM books", con)

con.Open()

Dim myDA As OleDbDataAdapter = New OleDbDataAdapter(cmd)

Dim myDataSet As DataSet = New DataSet()

myDA.Fill(myDataSet, "books")

Form1.dgvbook.DataSource = myDataSet.Tables("books")
con.Close()

con = Nothing

ok, so you open your dataset
and you fill it
myda.fill(myDataSet)
con.close

good

now bind the data to the datagrid

dgvbook.datasource = mydataset
dgvbook.databind

i think you are missing the databind event.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.