Solved

Reading XML, updating tables in SQL Server

Posted on 2004-09-21
9
269 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
  • 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
Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

 

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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Best way to parse out a json string in VB6? 10 228
FMX and jaudiotracker playing memory stream 29 87
Base1 Encode/Decode 3 82
Delphi android app hide keyboard 3 17
When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

828 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