Thread: ADO.net vs ADO
View Single Post
 
Old 05-13-2016, 03:32 PM
JerryEng JerryEng is offline
Junior Contributor
 
Join Date: Sep 2002
Location: Franklin, NC
Posts: 203
Default ADO.net vs ADO

I have an app that was developed in VB6 using ADO to get data from Access. I would like to to update the app using VB 2015. I'm having some trouble getting a handle on ADO.net. Could someone give a code snippet that would mimic the following VB6 code to put data in a recordset?

Public adoconnection1 As New ADODB.Connection
Public rs As New ADODB.Recordset
Private Sub Form_Load()

adoconnection1.Open "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source= C:\EC1\EC1Data.mdb"

rs.CursorLocation = adUseClient
rs.Open "Select * from Jobs Where JobNumber = 10243", adoconnection1, adOpenDynamic

Text1.Text = rs!JobName

rs.close

If I just have something to get started, I can usually figure it out from there. BTW, I'm not a developer, I'm an electrical engineer and the app is something 5 or 6 of us use in house. The app makes several calls to get data from the DB and update it but the majority of the calls return one row. The biggest call might return 75 rows but it displays them in a grid.
Reply With Quote