0

i have just installed visual studio 10. Im not familiar with it. I want to connect MDB file to it. I have googled that but could not find appropriate code. So would anyone help me finding the equivalent Visual Studio 10 code to the VB6 code i am pastng below.
Thanks in advance!

Private cn As ADODB.Connection
Private rs As ADODB.Recordset

Set cn = New ADODB.Connection
cn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\Test.mdb;Persist Security Info=false"
cn.Open
Set rs = New ADODB.Recordset
rs.Open "Sample", cn, adOpenKeyset, adLockPessimistic, adCmdTable

rs.MoveFirst
Dim FirstName As String
FirstName = rs.Fields("fname")

rs.Close
cn.close
2
Contributors
1
Reply
8
Views
3 Years
Discussion Span
Last Post by cgeier
0

I have a post here that shows using ADODB. It is on page 1. See "Version 4 (using ADODB and OleDbDataAdapter)" It is for DB2 Express, but just change the connection string and it should work.

For additional connection strings see:
Connection Strings

Edited by cgeier

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.