JH82
Member
Hi guys, my first post on here and i'm relatively new to VB.net so go easy on me please
I am doing a simple program to display some database records and at the moment i am writing code in a form load event procedure to populate a combobox from the database. My code looks like......
Imports System.Data
Imports System.Data.OleDb
Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim idConnectionString As String = "Provider=Microsoft.JET.OLEDB.4.0;data source=C:\Documents and Settings\Preferred Customer\My Documents\MCAD-MCSD\Doughnut Shop\bin\TheDoughnutShop.mdb"
Dim idConnection As OleDbConnection = New OleDbConnection(idConnectionString)
Dim sqlString As String = "SELECT * FROM Customers"
Dim idAdapter As OleDbDataAdapter = New OleDbDataAdapter(sqlString, idConnection)
Dim idDataSet As DataSet = New DataSet
idAdapter.Fill(idDataSet, "Customers")
cbCustomerID.DataSource = idDataSet.DefaultViewManager
It is throwing the excpetion "An unhandled exception of type 'System.Data.OleDb.OleDbException' occurred in system.data.dll" at the line i have highlighted in red.
any ideas?
(apologies if this is in the wrong place by the way)
jim
I am doing a simple program to display some database records and at the moment i am writing code in a form load event procedure to populate a combobox from the database. My code looks like......
Imports System.Data
Imports System.Data.OleDb
Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim idConnectionString As String = "Provider=Microsoft.JET.OLEDB.4.0;data source=C:\Documents and Settings\Preferred Customer\My Documents\MCAD-MCSD\Doughnut Shop\bin\TheDoughnutShop.mdb"
Dim idConnection As OleDbConnection = New OleDbConnection(idConnectionString)
Dim sqlString As String = "SELECT * FROM Customers"
Dim idAdapter As OleDbDataAdapter = New OleDbDataAdapter(sqlString, idConnection)
Dim idDataSet As DataSet = New DataSet
idAdapter.Fill(idDataSet, "Customers")
cbCustomerID.DataSource = idDataSet.DefaultViewManager
It is throwing the excpetion "An unhandled exception of type 'System.Data.OleDb.OleDbException' occurred in system.data.dll" at the line i have highlighted in red.
any ideas?
(apologies if this is in the wrong place by the way)
jim