Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Visual Basic > VB 6 Visual Basic 6 > VB How-To
Password Reminder
Register
| FAQ | Members List | Calendar | 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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #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

Reply With Quote
  #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
Reply With Quote
  #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

Reply With Quote
  #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
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


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



All times are GMT -4. The time now is 03:30 PM.


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