Solved

Reading XML, updating tables in SQL Server

Posted on 2004-09-21
9
270 Views
Last Modified: 2013-11-23
Hi
I want urgent help with VB6 code.

Heres the scenario:
I have an application. From application API I can define an interface to my VB DLL (for example: myDLL.myClass.myfunction)
From my application, I can select table and its columns to be used by myDLL
The data is exchanged in XML format.

I want to read this XML file/data into my function - Public Function myFunction(sXML As String) As Variant
This function,
-  reads XML file for tablename, column ID and corresponding column data - i.e
-  connect to SQL Server7.0
-  deletes the existing data in table in SQL Server using column ID info from XML
-  then updates same table with new data read from XML file

I have installed MSXML4.0
I need your help to create DLL, register and compile it

I am willing to start a new thread as and when required so that expert who is helping me gets as many point as possible!
0
Comment
Question by:Vasi04
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 6
  • 3
9 Comments
 

Author Comment

by:Vasi04
ID: 12110748
Tablename: Article
Column names:
ID, VT_VERSION, REFINANZIERBAR, SACHNR, ARTICLENAME, SERIALNO, TRANSFERPRICE, ANZHAL, TRANSFER_SUPP_MENGE, LISTPREIS_MENGE, ART_ANGEBOTSPREIS, ART_ANGEB_ABLOESE,                  
SERV_GRUNDBETRAG, REFERENZ_KENNZEICHEN
0
 

Author Comment

by:Vasi04
ID: 12111083
XML format:

<XML>
<DataCache USerid = "userid" username = "username">
<tablename1>
<columnname>colum value</columnname>
<columnname>colum value</columnname>
...
..
</tablename1>
<tablename2>
<columnname>colum value</columnname>
<columnname>colum value</columnname>
...
..
</tablename2>
...
..
</DataCache>
</XML>
0
 
LVL 26

Expert Comment

by:Rejojohny
ID: 12111704
is this homework .. or have u tried writing some code and is stuck at some place?

read MSDN on how to load an XML file into XMLDOM and how to query using xpath ...

something like
Public Function myFunction(sXML As String) As Variant
Dim xmlDoc
set xmlDoc = Server.CreateObject("Microsoft.XMLDOM")
xmlDoc.async = false
xmlDoc.loadxml(sXML)
...loop through the nodes and construct the SQL string ...
0
Creating Instructional Tutorials  

For Any Use & On Any Platform

Contextual Guidance at the moment of need helps your employees/users adopt software o& achieve even the most complex tasks instantly. Boost knowledge retention, software adoption & employee engagement with easy solution.

 

Author Comment

by:Vasi04
ID: 12111752
I want VB code. this is NOT homework. I never pay to get my homework done!! :-)
0
 
LVL 26

Accepted Solution

by:
Rejojohny earned 500 total points
ID: 12111874
y i asked that was because normally someone would post a question here only when they have already tried something and require help when they get some error which he/she is not able to solve. In ur case, u have asked for the complete code .. i do not think any expert might have the time to write the complete code for you .. anyway u might be lucky and get someone to do it ... all the best ...

sorry i posted the wrong solution ... try this ...

just add the refrence to "Microsoft xml" in ur project

 Dim xmlDoc As New MSXML2.DOMDocument40
xmlDoc.async = false
xmlDoc.loadxml(sXML)
set lobjRootNode = lobjXMLDoc.documentElement


loop through the "lobjRootNode" object to create the SQL string ...



0
 

Author Comment

by:Vasi04
ID: 12111935
Can some expert help me with code?
0
 

Author Comment

by:Vasi04
ID: 12113669
Dear Experts, please help
0
 

Author Comment

by:Vasi04
ID: 12116035
0
 
LVL 26

Expert Comment

by:Rejojohny
ID: 12130478
thx for the points .. but as i mentioned noone might like to spend time writing the complete code for u .. even i take time out my work to comment in EE just for brushing up on my skills and also to help anyone who might be in trouble coding .. but spending time writing the complete code .. if i had the time, i would have done it .. as u have mentioned in the other post, u could get the answer in the net .. try some of those out and come back with specific questions ...
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

732 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question