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'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