Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Visual Basic > VB 6 Visual Basic 6 > VB How-To
| Search | Today's Posts | Mark Forums Read
VB How-To Ask your "How do I do this with VB?" questions in this forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the VB How-To section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
  #1 (permalink)  
Old May 23rd, 2006, 09:02 AM
Registered User
 
Join Date: May 2006
Location: London, , United Kingdom.
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default 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

  #2 (permalink)  
Old May 24th, 2006, 02:35 AM
Friend of Wrox
Points: 687, Level: 9
Points: 687, Level: 9 Points: 687, Level: 9 Points: 687, Level: 9
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Dec 2004
Location: Chennai, Tamilnadu, India.
Posts: 221
Thanks: 0
Thanked 0 Times in 0 Posts
Default

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
  #3 (permalink)  
Old May 24th, 2006, 03:18 AM
Registered User
 
Join Date: May 2006
Location: London, , United Kingdom.
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi Raghavendra,

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

Regards
Darren

  #4 (permalink)  
Old May 24th, 2006, 03:31 AM
Friend of Wrox
Points: 687, Level: 9
Points: 687, Level: 9 Points: 687, Level: 9 Points: 687, Level: 9
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Dec 2004
Location: Chennai, Tamilnadu, India.
Posts: 221
Thanks: 0
Thanked 0 Times in 0 Posts
Default

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Nesting ADO recordsets yossarian Pro VB Databases 1 January 12th, 2005 06:28 PM
Need help with recordsets chacquard Access VBA 5 June 21st, 2004 11:58 PM
Creating & Populating Tables jitu ADO.NET 11 June 3rd, 2004 01:04 PM
Bindind data-bound grids to ADO recordsets module0000 VB Databases Basics 4 June 19th, 2003 11:17 PM
ADO could ADO counot find the specified provider. Rob Collie Classic ASP Databases 2 June 9th, 2003 04:12 AM





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