Hi all
Im trying to fill the ListBox with selected students name. Instead I have the ListBox fill with System.Data.DataRawView
Here is my code:
Im trying to fill the ListBox with selected students name. Instead I have the ListBox fill with System.Data.DataRawView
Here is my code:
Code:
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim thedata As DataSet
Dim theAdapter As OleDb.OleDbDataAdapter
Dim connectstring, sqlstr As String
connectstring = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\Documents and Settings\Administrator\My Documents\student.mdb"
sqlstr = "Select * from Student"
thedata = New DataSet()
Dim Student As DataTable = thedata.Tables.Add("Student")
theAdapter = New OleDb.OleDbDataAdapter(sqlstr, connectstring)
theAdapter.Fill(thedata, "Student")
ListBox1.DataSource = thedata.Tables("Student")
ListBox1.DisplayMember = "Studentname"
End Sub