V
vbDavidC
I have a procedure (private sub) that loads comboboxes on my form with
data from my access Db:
Dim SQL As String = "SELECT * FROM TableBlahBlah
Dim cmd As New OleDbCommand(SQL, con)
Dim reader As OleDb.OleDbDataReader = cmd.ExecuteReader()
Do While reader.Read
comboblahblah.Items.Add(reader(0))
Loop
I then want to populate a second combo box right after the first one.
I am new to ado.net and using objects so I am learning.
I cut and pasted the same code so I could use the same objects (I
guess), I did not want to recreate more objects. I guess it does not
matter if I do or not.
I am also wondering if I use my connection string to the DB can I
define it in the General area and just reference that DB once instead
of having to create it in all my procedures.
data from my access Db:
Dim SQL As String = "SELECT * FROM TableBlahBlah
Dim cmd As New OleDbCommand(SQL, con)
Dim reader As OleDb.OleDbDataReader = cmd.ExecuteReader()
Do While reader.Read
comboblahblah.Items.Add(reader(0))
Loop
I then want to populate a second combo box right after the first one.
I am new to ado.net and using objects so I am learning.
I cut and pasted the same code so I could use the same objects (I
guess), I did not want to recreate more objects. I guess it does not
matter if I do or not.
I am also wondering if I use my connection string to the DB can I
define it in the General area and just reference that DB once instead
of having to create it in all my procedures.