I am working on making the switch from Microsoft Access to VB.Net in visual studio 2008. I am trying to figure out how to create an ADODB recordset connection to the database for record manipulation. So far i've had no luck. The debugging of the program stops at the line where I open the recordset (rstest.open) and I'm not sure why. Can someone tell me what I'm doing wrong?
Dim rstest As ADODB.Recordset
Dim SQLrs As String
Dim cn As ADODB.Connection
Dim strtest As String
SQLrs = "SELECT tblProductNames.ID, tblProductNames.FName FROM tblProductNames WHERE (((tblProductNames.ID)=3));"
strtest = "DSN=Berry_DatSQL;Integrated Security=True"
cn = New ADODB.Connection
cn.CursorLocation = CursorLocationEnum.adUseClient
cn.Open(OdbcConnection1.ConnectionString, "", "", -1)
rstest = New ADODB.Recordset
rstest.Open(SQLrs, OdbcConnection1.ConnectionString, CursorTypeEnum.adOpenKeyset, LockTypeEnum.adLockOptimistic, 1)
txtProduct.Text = rstest.Fields.Item(2).Value
rstest = Nothing