Solved

Need library to import/export XML from VB 6.0 app that uses DAO databases in .mdb format

Posted on 2002-04-21
11
305 Views
Last Modified: 2012-05-04
Hi all,

Our requirement in the short term is to be able to import/export XML from our Visual Basic 6.0 applications (which use DAO interfaces to databases in .mdb format)
I don't want to write much code- I would like some sort of library that does most of the grunt work.

I have done quite a bit of searching on the web for a commercial strength product.
So far I have found:

1.  DbTkXml
http://www.profsoftware.com/dbtkxml/

This has a C++ API.  The standalone app seems to work OK.
I have asked the vendor if he has any VB 6.0 sample code.

2. WinAllora, WinAllora Express

http://www.hitsw.com

I have only just seen a press release on WinAllora Express (US$199) and it sounds promising.
I have applied for an evaluation copy.

Any further suggestions would be much appreciated.

Regards

Leigh

0
Comment
Question by:LeighWardle
  • 3
  • 3
  • 2
  • +3
11 Comments
 
LVL 4

Expert Comment

by:nachiket
Comment Utility
hi

microsoft has its own XML library nad parser... currently latest version of that is available is 4..  search for MSXML4 on microsoft website or google

following link may help... i m not sure.. but it should

http://go.microsoft.com/fwlink/?LinkId=3999

i think the below link is what u r looking for...

http://msdn.microsoft.com/downloads/default.asp?url=/downloads/sample.asp?url=/msdn-files/027/001/766/msdncompositedoc.xml

nachiket
0
 
LVL 1

Author Comment

by:LeighWardle
Comment Utility
nachiket, thanks for your suggestions.

I really want a library or componet that will automatically initiate an import or export at the Table level, simply by specifying the .mdb file name, Table or Query name and the .XML file name.  

I do not want to write code to handle each field in the table/query/XML file.

Would MSXML4 offer this?

Regards

Leigh
0
 
LVL 4

Expert Comment

by:nachiket
Comment Utility
LeighWardle

well

i don't know really will it help or not... y don't u download the whole SDK around 5 mb... it has excellent help file assoiciated with that... if microsoft provides n e help with this( if it is related to XML) this SDK will have it... and i guess if ur application is very obvious microsoft must have provided!! so better u check the documentation ur self

again this link might help u d/ling the SDK

http://msdn.microsoft.com/downloads/default.asp?url=/downloads/sample.asp?url=/msdn-files/027/001/766/msdncompositedoc.xml

nachiket
0
 
LVL 18

Expert Comment

by:mdougan
Comment Utility
before you give up on nachiket's idea, here are some specifics.

If you have the option of switching to ADO instead of DAO, then, it's possible to Save a Recordset to a Microsoft DOM document using the Recordset SAVE method (you actually might be able to save straight out to a file with this method, but I've always done it through the DOM).  Then, the DOM object has a .XML property that you can manually write out to a file if you want, or it also might have a .SAVE method to save to the file.  So, with just a few lines of code you can do this.

Dim Conn As ADODB.Connection
Dim Cmd As ADODB.Command
Dim Dom As MSXML2.DOMDocument
Const MY_DATABASE = "Provider=Microsoft.Jet.OLEDB.4.0;Persist Security Info=False;Data Source=H:\Code\MY.mdb"

Private Sub Form_Load()
Set Conn = New ADODB.Connection
With Conn
    .ConnectionString = MY_DATABASE
    .CursorLocation = adUseClient
    .Open
End With

End Sub

Private Sub cmdExport_Click()
     ExportTable "Employees", "C:\Temp\Emp.xml"
End Sub

Private Sub ExportTable(sTableName as String, sFileName as string)
Dim sSQL As String
Dim fHandle As Long

    sSQL = "SELECT * FROM " & sTableName

If Conn.State = adStateOpen Then
    Set Cmd = New ADODB.Command
    With Cmd
        .ActiveConnection = Conn
        .CommandType = adCmdText
        .CommandText = sSQL
    End With
   
    Set RS = Cmd.Execute
    If RS.State = adStateOpen Then
        Set Dom = New DOMDocument
        RS.save Dom, adPersistXML
        Dom.save sFileName
    End If
End If

RS.Close
Set RS = Nothing
Set Cmd = Nothing
Set Dom = Nothing

End Sub

To get this sample to work, you'd have to reference the Microsoft Active Data Objects 2.5 (or better) object library, and the Microsoft XML, 3.0 (or better) parser.

You can download the parser for free from Microsoft.

0
 
LVL 1

Author Comment

by:LeighWardle
Comment Utility
Thanks, mdougan, for your suggestion.

Is there anything analogous that will read XML into an ADO dataset?

By the way I have been experimenting with VB.NET- have been able to do the XML import/export stuff with just one line of code for each!!!!

Regards

Leigh
0
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 
LVL 18

Expert Comment

by:mdougan
Comment Utility
I've seen code where a recordset can Load data from an XML file, after specifying some sort of provider for reading text files... looks a little kludgey, but there may be a way to read into a DOM and then streaming into a recordset from there, which is a little cleaner maybe.
0
 
LVL 1

Author Comment

by:LeighWardle
Comment Utility
Thanks, mdougan, for your suggestion.
Any chance you can point me to the code where a recordset can Load data from an XML file?

Regards, Leigh
0
 
LVL 18

Accepted Solution

by:
mdougan earned 200 total points
Comment Utility
Actually, it might be simpler than I was thinking.  You don't have to use a DOM object (we were using DOM objects to manage the data in XML form)

objRecordset.Save "C:\Myfile.xml", adPersistXML
objRecordset.Close
Set objRecordset = Nothing
...
objRecordset.Open "C:\Myfile.xml"

Here are some links:
http://www.vbxml.com/xml/guides/developers/ado_persist_xml.asp

http://www.devguru.com/Technologies/ado/quickref/recordset_save.html

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/ado270/htm/mdconpersistdata.asp

0
 
LVL 1

Expert Comment

by:Moondancer
Comment Utility
Please finalize this question, open today.
Thanks,
Moondancer - EE Moderator
0
 
LVL 49

Expert Comment

by:DanRollins
Comment Utility
Hi LeighWardle,
It appears that you have forgotten this question. I will ask Community Support to close it unless you finalize it within 7 days. I will ask a Community Support Moderator to:

    Accept mdougan's comment(s) as an answer.

LeighWardle, if you think your question was not answered at all or if you need help, just post a new comment here; Community Support will help you.  DO NOT accept this comment as an answer.

EXPERTS: If you disagree with that recommendation, please post an explanatory comment.
==========
DanRollins -- EE database cleanup volunteer
0
 

Expert Comment

by:SpideyMod
Comment Utility
per recommendation

SpideyMod
Community Support Moderator @Experts Exchange
0

Featured Post

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
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…

743 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

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now