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
308 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
ID: 6959093
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
ID: 6959138
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
ID: 6959169
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
Optimizing Cloud Backup for Low Bandwidth

With cloud storage prices going down a growing number of SMBs start to use it for backup storage. Unfortunately, business data volume rarely fits the average Internet speed. This article provides an overview of main Internet speed challenges and reveals backup best practices.

 
LVL 18

Expert Comment

by:mdougan
ID: 6960972
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
ID: 6970271
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
 
LVL 18

Expert Comment

by:mdougan
ID: 6970447
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
ID: 6970474
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
ID: 6971472
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
ID: 7080001
Please finalize this question, open today.
Thanks,
Moondancer - EE Moderator
0
 
LVL 49

Expert Comment

by:DanRollins
ID: 7660629
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
ID: 7755344
per recommendation

SpideyMod
Community Support Moderator @Experts Exchange
0

Featured Post

Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

Question has a verified solution.

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

Suggested Solutions

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…
Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
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…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

777 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