p2p.wrox.com Forums

p2p.wrox.com Forums (http://p2p.wrox.com/index.php)
-   VB How-To (http://p2p.wrox.com/forumdisplay.php?f=78)
-   -   Creating/Populating Recordsets in ADO (http://p2p.wrox.com/showthread.php?t=42910)

dgulliver May 23rd, 2006 09:02 AM

Creating/Populating Recordsets in ADO
 
Hi,

It's been awhile since I've used ADO in VB6 but I was wondering how you could create a recordset without being connected to a Database in ADO. Basically we use Client Access to connect to a Iseries server and once we have returned data via cobol routines I was to place the data into an ADO recordset.

I've done this using ADO.Net but cannot figure it out in ADO 2.x

Example in ADO.NET

        Dim dsDataSet As New DataSet()
        Dim dtResults As DataTable = dsDataSet.Tables.Add("Table")

        dtResults = New DataTable()

        dtResults.Columns.Add("swftid", System.Type.GetType("System.String")) 'Message Type
        dtResults.Columns.Add("medind", System.Type.GetType("System.String")) 'Medium
        dtResults.Columns.Add("trntyp", System.Type.GetType("System.String")) 'Transaction
        dtResults.Columns.Add("probco", System.Type.GetType("System.String")) 'Problem Code
        dtResults.Columns.Add("paytyp", System.Type.GetType("System.String")) 'Payment Type
        dtResults.Columns.Add("cpcode", System.Type.GetType("System.String")) 'Counterparty
        dtResults.Columns.Add("secode", System.Type.GetType("System.String")) 'Security
        dtResults.Columns.Add("thdval", System.Type.GetType("System.String")) 'Value Threshols

then query database using cobol and return in to DataSet

            For i = 0 To iNumberReturned - 1
                row = dtResults.NewRow()
                row.Item(0) = Trim(WSTPINEX.LsWstpinexSwftid(i)
                row.Item(1) = Trim(WSTPINEX.LsWstpinexMedind(i)
                row.Item(2) = Trim(WSTPINEX.LsWstpinexTrntyp(i)
                row.Item(3) = Trim(WSTPINEX.LsWstpinexProbcode(i)
                row.Item(4) = Trim(WSTPINEX.LsWstpinexPaytyp(i)
                row.Item(5) = Trim(WSTPINEX.LsWstpinexCpcode(i)
                row.Item(6) = Trim(WSTPINEX.LsWstpinexSeccode(i)

                iCounter = iCounter + 1
                dtResults.Rows.Add(row)
            Next i

Would it be possible to show me the alternative in ADO2.x or point me in the right direction please.

Regards
Darren


Raghavendra_Mudugal May 24th, 2006 02:35 AM

Hello Darren

check this link
http://www.geocities.com/raghavendra...teRecrdset.zip

It shows how to work with Recordset without connecting to database.

Hope this helps.


With Regards,
Raghavendra Mudugal

dgulliver May 24th, 2006 03:18 AM

Hi Raghavendra,

Brilliant, Exactly what I need. Thanks so much for your help.

Regards
Darren


Raghavendra_Mudugal May 24th, 2006 03:31 AM

Hello Darren,

I am happy that I was helpful.

If you look into the source, if you change that "adPersistADTG" to
"adPersistXML", the data is saved in XML file which contains the
dynamic table structure at the begining and followed by the data.

something like this...

rst.Save App.Path & "\data1.xml", adPersistXML

This "adPersistsXML" is not listed in the there, its a hidden member.
So you can time it directly or change that ADTG to XML. Its done.

And open that XML file in internet explorer to explore more.

Hope this helps.


With Regards,
Raghavendra Mudugal


All times are GMT -4. The time now is 05:53 AM.

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.