Affiliate Marketing
Forum Search


Reply
 
LinkBack Thread Tools Display Modes

  #1 (permalink)  
Old 11-08-07
accelerator's Avatar
Online shopping rocks!
 
Join Date: Nov 2004
Location: England
Posts: 1,316
Thanks: 8
Thanked 29 Times in 26 Posts
accelerator is an unknown quantity at this point
  XML file into MySQL Database - Help with .net script

Hi All

I'm trying to write a VB.net script that will parse an AWIN XML file and insert its contents into a MySQL Products database. I am learning about XmlReader and XmlTextReader. So far, I have the code below, which will successfully display the contents of the xml file in the browser. However, I am a long way from getting it to insert into the database.

Any example scripts out there?

For a given <product></product> how do I retrieve the various tag values and put them into an SQL statement?

Do I add a SQL INSERT statement within the below loop?

Any comments and guidance appreciated.

Many thanks

Accelerator

__

Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) _
Handles Me.Load

Dim reader As XmlTextReader = New XmlTextReader(Server.MapPath("smartav.xml"))

'reads the first node, which is <?xml version="1.0" encoding="UTF-8"?>. We do not want to print this line; therefore, we will read it outside the loop and do nothing.
reader.Read()

While (reader.Read())

Response.Write(reader.Value)
Response.Write("<br />")

End While

End Sub
__
__________________
WebRef.eu - Web Development Resources for the Online Entrepreneur
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 13-08-07
Vivid's Avatar
Registered User
 
Join Date: May 2005
Location: NW London
Posts: 295
Thanks: 0
Thanked 0 Times in 0 Posts
Vivid is an unknown quantity at this point
  Re: XML file into MySQL Database - Help with .net script

I'm not a VB man so I can't help with your code but I did have a similar situation myself where I was loading a huge set of XML data in to a MySQL database. I tried many different pieces of software to achieve this and none did the trick so I tried Navicat. It actually didn't help with multiple XML files (like in a batch) but it did do a single file very nicely so I wrote to them and asked about multiple files/batch which they recently emailed me to say that had included in their latest release.

It might be worth a go.
__________________
Jester78 - Affiliate Marketing and general ramblings
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 15-08-07
accelerator's Avatar
Online shopping rocks!
 
Join Date: Nov 2004
Location: England
Posts: 1,316
Thanks: 8
Thanked 29 Times in 26 Posts
accelerator is an unknown quantity at this point
  Re: XML file into MySQL Database - Help with .net script

Thanks for your reply, I actually use Navicat at the moment, and I might look at their bulk upload if I can't do it with VB.net. My final objective is to get my MySQL product database to update automatically.

I need to code the following in VB.net:

1) Read through the XML file (AWIN version 1.0) until I find a <product> element.

2) Then loop through the child nodes and accumulate the relevant data for a database insert.

3) Do the database insert.

4) Move on to the next <product> element.

If there are any VB.net coders that could shed any light on how to code the above, particularly step 2) that would be much appreciated.

Rgds

Accelerator
__________________
WebRef.eu - Web Development Resources for the Online Entrepreneur
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 15-08-07
tbp tbp is offline
Registered User
 
Join Date: Dec 2006
Posts: 1,999
Thanks: 0
Thanked 18 Times in 18 Posts
tbp is an unknown quantity at this point
  Re: XML file into MySQL Database - Help with .net script

Have you looked in the MSN Developer Center?

They offer a number of free tutorials and E Books which i`m sure will give you the answer to your problem.

Also do a search for "msdn vb.net xml" in Google which comes up with a load of results i`m sure that could help you!
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Sponsored Links
  #5 (permalink)  
Old 16-08-07
Registered User
 
Join Date: Feb 2006
Location: Gillingham
Posts: 503
Thanks: 0
Thanked 0 Times in 0 Posts
Donk is an unknown quantity at this point
  Re: XML file into MySQL Database - Help with .net script

Try xmlfiles.com

This page uses vbscript. I don't know how easy it would be to translate into into VB but it might give you a few pointers, especially if you can access the "Microsoft.XMLDOM".
__________________
They came for my 404 and I said nothing
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #6 (permalink)  
Old 16-08-07
Registered User
 
Join Date: Sep 2003
Posts: 63
Thanks: 0
Thanked 0 Times in 0 Posts
monkeyboy is an unknown quantity at this point
  Re: XML file into MySQL Database - Help with .net script

If you are using .NET 2 the DataSet object has a ReadXml function, which loads the XML from a file into data tables.

Dim objDs As New DataSet()

objDs.ReadXml("C:\path\to\xml\My.xml")

You can then loop through the tables in the resultant dataset.
__________________
Prezzybox.com home of the gift wizard
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #7 (permalink)  
Old 04-09-07
Registered User
 
Join Date: Oct 2003
Posts: 93
Thanks: 0
Thanked 0 Times in 0 Posts
mcol is an unknown quantity at this point
  Re: XML file into MySQL Database - Help with .net script

if you're using mySql use the multiple insert format to stick the records into the database in batches. That'll cut your runtimes enormously.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Sponsored Links
  #8 (permalink)  
Old 13-09-07
zinc's Avatar
boo!
 
Join Date: May 2006
Location: Berkshire
Posts: 677
Thanks: 0
Thanked 0 Times in 0 Posts
zinc is an unknown quantity at this point
  Re: XML file into MySQL Database - Help with .net script

Accel check this out http://samples.gotdotnet.com/quickst...adXMLFile.aspx
__________________
Got web development?
www.zincstudios.co.uk
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
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 On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Instant XML Feed Script For Merchants John Jupp Widgets, Coding, AJAX, PHP - Technology & Affiliate Marketing 9 14-06-07 09:54 AM
Pagerank10 MySQL Productfeed Script with Admin Leeky The Affiliate Marketing Lounge 0 02-04-07 11:41 AM
67 Datafeed website scripts Leeky Widgets, Coding, AJAX, PHP - Technology & Affiliate Marketing 0 28-09-06 06:56 PM
xml > csv into mysql with a sprinkle of php morleymouse Widgets, Coding, AJAX, PHP - Technology & Affiliate Marketing 4 08-12-04 03:13 PM
Anyone anygood with xml, php, mysql and Affiliate Window AnnonnyMouse The Affiliate Marketing Lounge 1 23-09-04 11:00 AM


Affiliate Marketing RSS Feeds - Contact Us - Affiliate Marketing - Archive - Privacy Statement - Top

Content Relevant URLs by vBSEO 3.2.0 RC7