We help IT Professionals succeed at work.

Opening a xml-file with component TClientDataset.

Peter Kiers
Peter Kiers asked
on
Hi,

I have a Datasource1, a ClientDataSet and a DBGrid on my form.
I have adjusted the following:
=> Set property DataSet from DataSource1 to ClientDataSet1.
=> Set property DataSource from DBGrid1 to DataSource1
=> Set property FileName from ClientDataSet1 to the xml-file in my folder

When I set ClientDataSet property Active to True I get the message:
Mismatch in datapacket.

What do I have to do to make this work, there is also a tutorial on the
internet how to do it. Explained in the first minute of the movie.:

Delphi Programming Tutorial #24 - DBGrid OnDrawColumnCell

But I can not make it work. I think it has to do
something with the xml-file.

Who knows the answer and is willing to help me or give me an example.

Greetings,

Peter Kiers
Comment
Watch Question

Commented:
Did you install delphi with dbexpress?

Commented:
because if you have, try to use it, its more simplier, incase you want to use msconnection

Commented:
Ok, are you tring to display the xml file to the dbgrid?
Peter KiersOperator

Author

Commented:
yes, i try to display the xml file to the dbgrid.
Peter KiersOperator

Author

Commented:
anyone online that could help me?
I just want to read a xml file with a dbgrid.

Commented:
your xml data is not compatible with clientdataset, you have to use a xml mapper do import your xml file to clientdataset
Peter KiersOperator

Author

Commented:
How?
Peter KiersOperator

Author

Commented:
Oke I have the TXMLDocument component on my form.
And set the property FileName to my xml-file.
Now what can I  do to make it work??????

Commented:
using the download, did the xml file open with your clientdataset?

txmldocument has nothing to do with this

Commented:
use txmltransform instead if you have delphi 6
Peter KiersOperator

Author

Commented:
I need an example

Commented:
ilL leave you with this link;
http://delphi.about.com/od/usedbvcl/a/tclientdataset.htm

good luck
Peter KiersOperator

Author

Commented:
oke, it works. Could you please tell me why your xml-file works and other dont.
Before I give you the points.

Commented:
the xml file that you have, is not compatible with the clientdataset, but the link that i gave you with the xml file, if it loads, meaning the xml data is compatible with the clientdataset,  if you have delphi 6 you can use txmltransform component. otherwise if you dont have it, you have to look for a component that maps xml data to delphi dataset.