Qotada Qotada - 6 months ago 14
Vb.net Question

Unappear data from database in data grid view vb.net Visual Studio 2010

I want to appear field from my table database to data grid view like this but not success.
my data from table unappear in data grid view this is my result

okey i want to show my script

this is my module script connection

Imports System.Data.OleDb


Module module_koneksi
Public conn As OleDbConnection
Public cmd As OleDbCommand
Public ds As DataSet
Public dr As OleDbDataReader
Public da As OleDbDataAdapter
Public lokasidata As String

Public Sub konek()
lokasidata = "provider=microsoft.jet.oledb.4.0;data source=db_access.mdb"
conn = New OleDbConnection(lokasidata)
If conn.State = ConnectionState.Closed Then
conn.Open()
End If
End Sub
End Module


and this is my mudule form

Public Class Form1

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
konek()
da = New OleDb.OleDbDataAdapter("SELECT * FROM tb_biodata", conn)
ds = New DataSet
ds.Clear()
da.Fill(ds, "tb_biodata")
DataGridView1.DataSource = ds.Tables("tb_biodata")
da.Dispose()
ds.Dispose()
conn.Close()
End Sub
End Class


So help me to appear database in grid view !

D T D T
Answer

Set DataPropertyName of Column is column name of datatable. Reference image : enter image description here