thirteentwenty
Well-known member
I know this has been asked many times before, and I've read _most_ of the posts here (and elsewhere) but still haven't been able to figure this out.
OK so here goes (be gentle I was put into VB.NET against my will)
I have to connect to a data base (done code to follow) and populate several comboboxes (drilldown to boot), now I've done this once before but the method that I was using just didn't work as well as I thought it would (every time i added a combobox the load time for the form got longer and longer) so I decided to start from scratch...
Here's what I have so far, in a module i have this to open my database. The items that are commented out because they haven't been used yet.
I placed this in a module because I'll have to reference the database across several forms (if there is a better way please let me know), and I'll be gathering stuff from different tables to populate different items on the same form...
basically I'm looking to create something (with the help of the good folks here) that I can reuse throughout the program...
To fill the combobox in the other version that I had (I can admit it, a straight copy and paste job)
how do i proceed?
Back story... I once built a web site for myself boss says build program... I say I can try... here I am one hair away from over my head...
Any help is appreciated...
And on a side note (read: question)
I understand why there are so many different ways to connect to a database (for the different types) but why is it that there are so many ways to get the same thing done? and why hasn't any one put a step by step together (an extremely basic thing that is) if there was one I couldn't find it... anyways...
thanks in advance to whom ever helps out...
OK so here goes (be gentle I was put into VB.NET against my will)
I have to connect to a data base (done code to follow) and populate several comboboxes (drilldown to boot), now I've done this once before but the method that I was using just didn't work as well as I thought it would (every time i added a combobox the load time for the form got longer and longer) so I decided to start from scratch...
Here's what I have so far, in a module i have this to open my database. The items that are commented out because they haven't been used yet.
I placed this in a module because I'll have to reference the database across several forms (if there is a better way please let me know), and I'll be gathering stuff from different tables to populate different items on the same form...
basically I'm looking to create something (with the help of the good folks here) that I can reuse throughout the program...
VB.NET:
Dim con As OleDb.OleDbConnection
Dim query As String
Public Function openDB()
Dim connectionString As String = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=test.mdb"
con = New OleDb.OleDbConnection(connectionString)
'Dim ds As New DataSet
'Dim da As OleDb.OleDbDataAdapter
'Dim dt As DataTable
'Dim dr As DataRow
'da = New OleDb.OleDbDataAdapter(query, con)
con.Open()
End Function
To fill the combobox in the other version that I had (I can admit it, a straight copy and paste job)
VB.NET:
For Each rDataRow In rDataTable.Rows
cmb_inv_reporter.Items.Add(rDataRow.Item("Name"))
Next
how do i proceed?
Back story... I once built a web site for myself boss says build program... I say I can try... here I am one hair away from over my head...
Any help is appreciated...
And on a side note (read: question)
I understand why there are so many different ways to connect to a database (for the different types) but why is it that there are so many ways to get the same thing done? and why hasn't any one put a step by step together (an extremely basic thing that is) if there was one I couldn't find it... anyways...
thanks in advance to whom ever helps out...