vb6 to vb.net database question
I have a simple VB.NET question
I upgraded this simple testform to VB.NET
there are no compile errors but when i click on the command button the
program hangs with a com error
it hangs when it reaches this line rs.Open()
anybody has any ideas
TIA
************************************************VB6*************************
********************
Private Sub Command3_Click()
Dim cn As New ADODB.Connection, rs As New ADODB.Recordset
Const DBPATH = "D:\Parma\Parma.mdb;Persist Security Info=False"
cn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & DBPATH
Set rs.ActiveConnection = cn
rs.Source = "Select * from workers where ID = 1"
rs.Open
txtLastName.Text = rs("LastName")
txtFirstName.Text = rs("FirstName")
rs.Close
cn.Close
Set cn = Nothing
Set rs = Nothing
End Sub
************************************************VB.NET**********************
***********************
Private Sub Command3_Click(ByVal eventSender As System.Object, ByVal
eventArgs As System.EventArgs)
Dim cn As ADODB.Connection = New ADODB.Connection()
Dim rs As ADODB.Recordset = New ADODB.Recordset()
Const DBPATH As String = "D:\Parma\Parma.mdb;Persist Security
Info=False"
cn.Open("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" &
DBPATH)
rs.ActiveConnection = cn
rs.Source = "Select * from workers where ID = 1"
rs.Open()
txtLastName.Text = rs.Fields("LastName").Value
txtFirstName.Text = rs.Fields("FirstName").Value
rs.Close()
cn.Close()
cn = Nothing
rs = Nothing
End Sub