Hi,
I'm trying to build a simple windows forms application and I'm stuck up with a problem.
Could not find file 'some\path\example.mdb'
here are my variables:
Private m_dbconn As OleDbConnection
Private m_dbReader As OleDbDataReader
Private m_dbCmd As OleDbCommand
Private m_dbConnString As String = "Provider=Microsoft.Jet.OLEDB.4.0;" + _ "Data Source=some\path\.mdb"
Private m_bLoaded As Boolean = False
Load form code:
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim bFirst As Boolean
Dim sDept As String
m_dbconn = New OleDbConnection(m_dbConnString)
m_dbCmd = m_dbconn.CreateCommand()
m_dbconn.Open()
bFirst = True
Dim cmdText As String = "SELECT DISTINCT LastName from Employees"
m_dbCmd.CommandText = cmdText
m_dbReader = m_dbCmd.ExecuteReader()
Do While (m_dbReader.Read())
sDept = CStr(m_dbReader.Item("LastName"))
If bFirst Then
cemp.Text = sDept
End If
cemp.Items.Add(sDept)
Loop
m_dbReader.Close()
m_bLoaded = True
End Sub
Any kind of help would be appreciated...
Dave
I'm trying to build a simple windows forms application and I'm stuck up with a problem.
Could not find file 'some\path\example.mdb'
here are my variables:
Private m_dbconn As OleDbConnection
Private m_dbReader As OleDbDataReader
Private m_dbCmd As OleDbCommand
Private m_dbConnString As String = "Provider=Microsoft.Jet.OLEDB.4.0;" + _ "Data Source=some\path\.mdb"
Private m_bLoaded As Boolean = False
Load form code:
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim bFirst As Boolean
Dim sDept As String
m_dbconn = New OleDbConnection(m_dbConnString)
m_dbCmd = m_dbconn.CreateCommand()
m_dbconn.Open()
bFirst = True
Dim cmdText As String = "SELECT DISTINCT LastName from Employees"
m_dbCmd.CommandText = cmdText
m_dbReader = m_dbCmd.ExecuteReader()
Do While (m_dbReader.Read())
sDept = CStr(m_dbReader.Item("LastName"))
If bFirst Then
cemp.Text = sDept
End If
cemp.Items.Add(sDept)
Loop
m_dbReader.Close()
m_bLoaded = True
End Sub
Any kind of help would be appreciated...
Dave