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 June 11th, 2003, 09:10 AM
Authorized User
 
Join Date: Jun 2003
Location: , , .
Posts: 12
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via ICQ to beyondforsaken Send a message via MSN to beyondforsaken
Default whole database to XML doc

what i have here is one entry turned to xml i don't want that i want to turn all the entries to a XML document.Can anyone help?:D



'Creates document outline
        Const strFileName As String = "c:/Beyonder/XMLExample.xml"
        Dim objXmlTW As XmlTextWriter = New XmlTextWriter(strFileName, Encoding.UTF8)

        'Sets the indentation for the XML file
        objXmlTW.Formatting = Formatting.Indented
        objXmlTW.Indentation = 4


        'Write root element
        objXmlTW.WriteStartElement("document")
        objXmlTW.WriteElementString("Name", editName.Text)
        objXmlTW.WriteElementString("Address", editAddress.Text)
        objXmlTW.WriteElementString("Telephone", editTelephone_Number.text)
        objXmlTW.WriteFullEndElement()


        'Write to the file and close
        objXmlTW.Flush()
        objXmlTW.Close()

        TextBox1.Text = TextBox1.Text + ReadDocument(strFileName)
Reply With Quote
  #2 (permalink)  
Old June 11th, 2003, 10:58 AM
Authorized User
 
Join Date: Jun 2003
Location: Livermore, CA, USA.
Posts: 17
Thanks: 0
Thanked 0 Times in 0 Posts
Default

dim rs
rs.open select * from table, connobject
if not rs.eof then
 objxmltw.writestartelement("document")
 while not rs.eof
   for each field in rs.fields
       objxmltw.writeelementstring(field.name,field.value )
   next
  rs.movenext
  wend
rs.close
Reply With Quote
  #3 (permalink)  
Old June 11th, 2003, 11:04 AM
Friend of Wrox
Points: 3,489, Level: 24
Points: 3,489, Level: 24 Points: 3,489, Level: 24 Points: 3,489, Level: 24
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Central, NJ, USA.
Posts: 1,102
Thanks: 0
Thanked 2 Times in 2 Posts
Default

Where is your loop?


Hal Levy
Daddyshome, LLC
Reply With Quote
  #4 (permalink)  
Old June 11th, 2003, 07:54 PM
Authorized User
 
Join Date: Jun 2003
Location: , , .
Posts: 12
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via ICQ to beyondforsaken Send a message via MSN to beyondforsaken
Default

sorry but which is coding which is code? my file name is hotel.mdb,what is connoobject? can u explain in detail?thanks..



Quote:
quote:Originally posted by Jstmehr4u3
 dim rs
rs.open select * from table, connobject
if not rs.eof then
 objxmltw.writestartelement("document")
 while not rs.eof
   for each field in rs.fields
       objxmltw.writeelementstring(field.name,field.value )
   next
  rs.movenext
  wend
rs.close
Reply With Quote
  #5 (permalink)  
Old June 11th, 2003, 08:12 PM
Authorized User
 
Join Date: Jun 2003
Location: , , .
Posts: 12
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via ICQ to beyondforsaken Send a message via MSN to beyondforsaken
Default

Is this correct? can anyone explain whats happening?is it correctly done?




Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

        'Creates document outline
        Const strFileName As String = "c:/Beyonder/XMLExample.xml"
        Dim objXmlTW As XmlTextWriter = New XmlTextWriter(strFileName, Encoding.UTF8)

        'Sets the indentation for the XML file
        objXmlTW.Formatting = Formatting.Indented
        objXmlTW.Indentation = 4

        Dim rs
       If Not rs.eof Then
        objXmlTW.WriteStartElement("document")
       While Not rs.eof
        For Each field In rs.fields
           objXmlTW.WriteElementString(field.name, field.value)
       Next
       rs.movenext()
       End While
        End If
        rs.close()


        'Write root element
        'objXmlTW.WriteStartElement("document")
        'objXmlTW.WriteElementString("Name", editName.Text)
        'objXmlTW.WriteElementString("Address", editAddress.Text)
        'objXmlTW.WriteElementString("Telephone", editTelephone_Number.Text)
        'objXmlTW.WriteFullEndElement()


        'Write to the file and close
        'objXmlTW.Flush()
        'objXmlTW.Close()

        TextBox1.Text = TextBox1.Text + ReadDocument(strFileName)

    End Sub
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
Creating XML doc ; writing string(xml format) into KamalRaturi XML 5 May 28th, 2008 05:51 AM
Reading XML doc into dataset ankitd25 XML 4 April 29th, 2008 02:37 AM
Analyze XML doc using XSLT shumba XSLT 5 March 24th, 2006 05:19 PM
Help making a doc using XML topshed XML 2 January 28th, 2006 08:05 PM
Problem with For loop, iterating through XML Doc rj_mayer Classic ASP XML 2 April 6th, 2004 01:16 PM



All times are GMT -4. The time now is 08:45 PM.


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