EDN Admin
Well-known member
Hi,
I use this code to populate info from Access DB to txtBox:
I want to do the same with a comboBox, how can I do it, please?
Best Regards
View the full article
I use this code to populate info from Access DB to txtBox:
Code:
Public Class frm
Dim inc As Integer<br/>
Dim MaxRows As Integer
Dim con As New OleDb.OleDbConnection
Dim dbProvider As String<br/>
Dim dbSource As String
Dim ds As New DataSet<br/>
Dim da As OleDb.OleDbDataAdapter<br/>
Dim sql As String
Private Sub frm_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load
<br/>
dbProvider = "PROVIDER=Microsoft.Jet.OLEDB.4.0;"<br/>
dbSource = "Data Source = c:DB.mdb;Jet OLEDB:Database Password=pass;"
con.ConnectionString = dbProvider & dbSource
con.Open()
sql = "SELECT * FROM Table"<br/>
da = New OleDb.OleDbDataAdapter(sql, con)<br/>
da.Fill(ds, "Hello")
MsgBox("Database is now open")
con.Close()
MaxRows = ds.Tables("Hello").Rows.Count<br/>
inc = -1
End Sub
<br/>
txtBox1.Text = ds.Tables("Hello").Rows(inc).Item(3)<br/>
txtBox2.Text = ds.Tables("Hello").Rows(inc).Item(1)
End Sub
<br/>
End Class<br/>
I want to do the same with a comboBox, how can I do it, please?
Best Regards
View the full article