Re: Proxy between VB6 ADO and ADO.Net

From: William \(Bill\) Vaughn (billvaRemoveThis_at_nwlink.com)
Date: 03/22/04

  • Next message: Ross McKay: "Re: query with parameters and asp"
    Date: Mon, 22 Mar 2004 14:44:14 -0800
    
    

    It's easy to go from the OLE DB ADO Recordset to a .NET DataSet.
    The OleDb .NET Data Provider exposes the Fill method with an overload that
    can take a Recordset as an input parameter.

        myDataAdapter.Fill(myDataSet, myRecordset)

    Going in the other direction is a lot harder but possible. I discuss this in
    my session this week at VSLive in SFO.

    hth

    Online help shows:
    Dim custDA As OleDbDataAdapter = New OleDbDataAdapter()
    Dim custDS As DataSet = New DataSet

    'Use ADO objects from ADO library (msado15.dll) imported
    ' as .NET library ADODB.dll using TlbImp.exe
    Dim adoConn As ADODB.Connection = New ADODB.Connection()
    Dim adoRS As ADODB.Recordset = New ADODB.Recordset()

    adoConn.Open("Provider=SQLOLEDB;Data Source=localhost;Initial
    Catalog=Northwind;Integrated Security=SSPI;", "", "", -1)
    adoRS.Open("SELECT * FROM Customers", adoConn,
    ADODB.CursorTypeEnum.adOpenForwardOnly, ADODB.LockTypeEnum.adLockReadOnly,
    1)

    custDA.Fill(custDS, adoRS, "Customers")

    adoConn.Close()
    .

    -- 
    ____________________________________
    William (Bill) Vaughn
    Author, Mentor, Consultant
    Microsoft MVP
    www.betav.com
    Please reply only to the newsgroup so that others can benefit.
    This posting is provided "AS IS" with no warranties, and confers no rights.
    __________________________________
    "Holt" <anonymous@discussions.microsoft.com> wrote in message
    news:8FDEDA5B-EDA1-475B-A607-7FB5FAE7F2C8@microsoft.com...
    > I have an n-tier application that was built in VB6 and uses the old ADO
    recordsets to pass data between layers.  I would like to rewrite part of the
    application, but cannot afford to rewrite it all.  Has anyone built a proxy
    class for taking a recordset and transforming it into a dataset?
    

  • Next message: Ross McKay: "Re: query with parameters and asp"

    Relevant Pages

    • Problem creating PivotTable from ADO recordset using VBA
      ... I am trying to create a PivotTable from VBA code in which I first query an ... PivotCache.Recordset to the ADO recordset. ... Dim rsClaims As ADODB.Recordset ... .Orientation = xlDataField ...
      (microsoft.public.excel.programming)
    • Re: How to save ADO Recordet as Access Table
      ... External Data -> Link and choosing Exchange() as the file type. ... I have a lot of data collected in Outlook folders. ... Outlook data using ADO into an open ADO recordset. ... Dim objOLApp As Outlook.Application ...
      (microsoft.public.access.modulesdaovba)
    • Re: vB error in converted Access database application
      ... is interpreting MyData as an ADO recordset, ... Dim MyData As DAO.Recordset ... >buttion is clicked (on a database lookup to a SQL ...
      (microsoft.public.access.conversion)
    • why a form bound to ADO recordset from DB2 is readonly
      ... I created a form bound to ADO recordset containing data from DB2 ... Dim myconnection As ADODB.Connection ... .CursorLocation = adUseClient ...
      (microsoft.public.access.formscoding)