Thread: VBA -> C++ (how to use CRecordset?)

  1. #1
    Registered User
    Join Date
    May 2012
    Posts
    2

    VBA -> C++ (how to use CRecordset?)

    Hello,

    I'm converting some VBA code into C++! Some problems I'm having is ... converting the following VBA code shown below:

    Dim Temp As ADODB.Recordset, F As ADODB.Field
    Temp = New ADODB.Recordset
    int i = 0


    For Each F In tableOne.Fields
    Temp.Fields.Append(tableNames(0) & F.Name, F.Type, F.DefinedSize, F.Attributes And adFldisNullable)
    With Temp(tableNames(0) & F.Name)
    .Precision = F.Precision
    .NumericScale = F.NumericScale
    End With
    i = i + 1
    Next

    I would like to loop through the fields like the code shown above using CRecordsets and append them into a new CRecordset...
    is that possible? if not, what other ways can I do this?

  2. #2
    Registered User Codeplug's Avatar
    Join Date
    Mar 2003
    Posts
    4,981
    You don't want to use CRecordset, or CDaoRecordset either. Use COM to interact with ADO directly:
    ADO Code Examples in Visual C++

    gg

  3. #3
    Registered User
    Join Date
    May 2012
    Posts
    2
    is it not possible for me to use CRecordsets?
    The problem is there are lot of functions that is made for CRecordsets... and it would make it very complicated for me to use something else.
    Unless I can use ADO and convert it to Crecordset later...
    Also, it seems like the link you sent me is broken and it would be great if someone can show me how to use ADO code "sample code" would be GREAT!

    Thanks!

  4. #4
    Registered User Codeplug's Avatar
    Join Date
    Mar 2003
    Posts
    4,981
    >> Temp.Fields.Append
    I don't see how to do that with CRecordset or CDaoRecordset.

    MSDN seems to be down right now. There are lots of samples there, once it's back.

    gg

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. CRecordset too slow
    By novacain in forum Windows Programming
    Replies: 4
    Last Post: 05-09-2007, 10:36 PM
  2. CRecordset and nulls
    By redfiche in forum Windows Programming
    Replies: 3
    Last Post: 08-02-2005, 09:39 AM
  3. MFC insert into access db (CRecordset)
    By maes in forum Windows Programming
    Replies: 11
    Last Post: 12-23-2003, 08:49 PM
  4. CRecordset CListCtrl
    By MPSoutine in forum Windows Programming
    Replies: 1
    Last Post: 04-02-2003, 08:31 AM
  5. CDatabase & CRecordset
    By endo in forum Windows Programming
    Replies: 0
    Last Post: 08-17-2002, 12:06 PM