Private Sub ReadData()
Dim i As Integer
con.ConnectionString = ("Provider = Microsoft.JET.OLEDB.4.0;Data Source= D:\Only Me\Authors.mdb")
Try
cmdOle = con.CreateCommand
cmdOle.CommandText = "SELECT * FROM Authors "
da.SelectCommand = cmdOle
da.Fill(dsOle, "Authors")
dtOle = dsOle.Tables("Authors")
For i = 0 To dtOle.Rows.Count - 1
cmbAuthor.Items.Add(dtOle.Rows(i).Item(1))
Next
Catch ex As Exception
MsgBox("Error: " & ex.Source & ": " & ex.Message, MsgBoxStyle.OKOnly, "Koneksi Error !!")
End Try
con.Close()
End Sub
in looping function ReadData will fill cmbAuthor with 2nd column from table author (.item(1), index start from 0). cmbAuthor.Items.Add(dtOle.Rows(i).Item(1))
Jx_Man
Nearly a Senior Poster
3,329 posts since Nov 2007
Reputation Points: 1,372
Solved Threads: 444