1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Creating XML file from access database with asp.net (vb)

Discussion in 'Visual Basic ( VB )' started by hr_coder, Sep 3, 2008.

  1. hr_coder

    hr_coder New Member

    Joined:
    Sep 3, 2008
    Messages:
    1
    Likes Received:
    0
    Trophy Points:
    0
    (=I'm from Croatia so forgive me on wrong words or gramatic=)
    IF there's some good human to help me, PLEASE HELP!
    I don't know about ASP.NET nothing, so I'ma asking for Help from some experts.
    I nedd to create XML file from reciords from access database.
    I+ve began with something but somebody said to me that this is wrong, this creates xml
    Code:
    <%@ Import Namespace="System.Data.OleDb" %>
    <script runat="server">
    sub Page_Load
    	
    	
    	dim file_being_created, act, rs, fso, counter
    	' Name for the ouput document 
    	file_being_created= "vitus.xml"
    
    	' create a file system object
    	fso = createobject("scripting.filesystemobject")
    
    	' create the text file - true will overwrite any previous files
    	' Writes the db output to a .xml file in the same directory 
    	act = fso.CreateTextFile(server.mappath(file_being_created), true)
    
    	' All non repetitive xml on top goes here
    	act.WriteLine("<?xml version=""1.0""?>")
    		act.WriteLine("<properties>")
    		
    
    		
    		 act.WriteLine("<property>")
    
    			act.WriteLine("<property-id></property-id>")
    	
    
    			act.WriteLine("<language>")
    
    			act.WriteLine("</language>")
    			
    
    
    
    			act.WriteLine("<date-listed>")
    
    			act.WriteLine("</date-listed>")
    			
    
    
    			act.WriteLine("<property-type>")
    
    			act.WriteLine("</property-type>")
    
    
    			
    			act.WriteLine("<listing-type>")
    
    			act.WriteLine("</listing-type>")
    
    
    			
    			act.WriteLine("<price>")
    				act.WriteLine("<amount>")
    
    				act.WriteLine("</amount>")
    
    				act.WriteLine("<currency>")
    
    				act.WriteLine("</currency>")
    			act.WriteLine("</price>")
    
    
    			
    			act.WriteLine("<property-size>")
    				act.WriteLine("<number>")
    
    				act.WriteLine("</number>")
    
    
    				act.WriteLine("<unit>")
    
    				act.WriteLine("</unit>")
    			act.WriteLine("</property-size>")
    			
    
    			
    			act.WriteLine("<location>")
    				act.WriteLine("<postal-code>")
    
    				act.WriteLine("</postal-code>")
    
    
    				act.WriteLine("<city>")
    
    				act.WriteLine("</city>")
    			act.WriteLine("</location>")
    
    			
    			
    			act.WriteLine("<title>")
    
    			act.WriteLine("</title>")
    			
    
    			
    			act.WriteLine("<description>")
    
    			act.WriteLine("</description>")
    
    			
    			
    			act.WriteLine("<features>")
    				act.WriteLine("<bathrooms>")
    
    				act.WriteLine("</bathrooms>")
    
    
    				act.WriteLine("<bedrooms>")
    
    				act.WriteLine("</bedrooms>")
    
    
    				act.WriteLine("<age>")
    
    				act.WriteLine("</age>")
    
    
    				act.WriteLine("<floor>")
    
    				act.WriteLine("</floor>")
    
    			act.WriteLine("</features>")
    
    
    
    			act.WriteLine("<link>")
    
    			act.WriteLine("</link>")
    
    
    
    			act.WriteLine("<images>")
    
    				act.WriteLine("<image>")
    
    				act.WriteLine("</image>")
    
    			act.WriteLine("</images>")
    
    		act.WriteLine("</property>")
    
    
    
    		' All non repetitive xml on bottom goes here
    		act.WriteLine("</properties>")
    
    
    	' close the object (xml)
    	act.close
    
    
    	' Writes a link to the newly created xml document in the browser
    	response.write ("<a href='vitus.xml'>Vitus</a> (.xml) je kreiran<br>")
    	response.write (now() & "<br>")
    end sub
    </script>
    
    
    
    
    This work's but i nedd to put betveen this tags variables from database.
    Is there any hope that somebody would help me!
    Thanks
     

Share This Page