Importing an xml into sqlCE

T

Tim De Vogel

hi,

I'm trying to read a xml file in SQLCE using visual studio 2005 and CF2.0
for pocketpc2003.
The code that I'm trying doesn't give me any errors, but I'm unable to get
the data into my table.
The structure of the xml is basically the same (fieldnames etc) then the
table.



Dim dsKlanten As New DataSet()
Dim XmlKlantPath As string = "pathtoxmlfile.xml"
Dim sqlConn As New SqlCeConnection("DataSource=\Program
Files\application\application.sdf")
Try
dsKlanten.ReadXml(XmlKlantPath)
Dim da As SqlCeDataAdapter = New SqlCeDataAdapter("select * from
tblCustomers where 1 = 0", sqlConn)
da.FillSchema(dsKlanten, SchemaType.Mapped, "NEWDATASET")
Dim cb As SqlCeCommandBuilder = New SqlCeCommandBuilder(da)
da.MissingMappingAction = MissingMappingAction.Passthrough
da.InsertCommand = cb.GetInsertCommand()
da.Update(dsKlanten, "NEWDATASET")
da.Dispose()
MsgBox("Done!")


Can anyone point me into a direction where I might be going wrong?
Otherwise a piece of alternative, working code to do the same thing is also
ok.

Regards,
Tim
 
I

Ilya Tumanov [MS]

Consider loading schema into the dataset before data.

Also, consider not using command builder by providing update/insert command.


Best regards,

Ilya

This posting is provided "AS IS" with no warranties, and confers no rights.

*** Want to find answers instantly? Here's how... ***

1. Go to
http://groups-beta.google.com/group/microsoft.public.dotnet.framework.compactframework?hl=en
2. Type your question in the text box near "Search this group" button.
3. Hit "Search this group" button.
4. Read answer(s).
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top