ADO to ADO.Net

Roey

Well-known member
Joined
Oct 10, 2002
Messages
238
Location
Canada
I have a 3 tier application that I amd trying to convert from VB6 to .Net

Listed below is the code to acces some of the data using ADO

___________________________________________________

Option Explicit

Private cnMRP As ADODB.Connection
Private strSQL As String
Private rsGeneric As New ADODB.Recordset
Private rsCountry As New ADODB.Recordset
___________________________________________________
Private Sub Class_Initialize()

Set cnMRP = New ADODB.Connection
cnMRP.ConnectionString "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\Elantis\MRP.mdb;Persist Security Info=False"

End Sub
___________________________________________________
Private Sub Class_Terminate()

Set cnMRP = Nothing

End Sub
___________________________________________________
Public Function Get_Country(CountryCode As String) As ADODB.Recordset

cnMRP.Open
cnMRP.CursorLocation = AdUseClient .

strSQL = "SELECT tblCountryMaster.CountryCode, tblCountryMaster.Description " & _
"FROM tblCountryMaster " & _
"WHERE CountryCode = " & CountryCode & ""

Set Get_Country = cnMRP.Execute(strSQL)
Get_Country.ActiveConnection = Nothing
cnMRP.Close

End Function
___________________________________________________

I have some information on making the connection using ADO.Net, but am not sure how to break down the individual function calls.

Any help on this would be greatly appreciated.
 
Back
Top