XML to SQLCE

A

Amirallia

Hi,

I want to import my data from a XML file to a SqlCE db. I use VB.NET

What's the best solution to do this ?

Thanks
 
G

Ginny Caughey [MVP]

Amiralla,

The easiest way would be to read the XML into a DataSet using
DataSet.ReadXml and then write that out to your SqlCe file.
 
A

Amirallia

Ginny Caughey [MVP] avait soumis l'idée :
Amiralla,

The easiest way would be to read the XML into a DataSet using DataSet.ReadXml
and then write that out to your SqlCe file.

But do you think I must create the structure of the tables, or there is
a methode that do this at runtime?

The readXML methode read the XML file and how put the data into the
table of my DB?
 
P

Peter Foot [MVP]

You will need to create the tables in your database. There is no automatic
way to do this, so you'll have to example the tables in the dataset,
enumerate their columns and piece together a CREATE TABLE sql statement,
then you can import the data.

Peter
 
A

Amirallia

Peter Foot [MVP] a présenté l'énoncé suivant :
You will need to create the tables in your database. There is no automatic
way to do this, so you'll have to example the tables in the dataset,
enumerate their columns and piece together a CREATE TABLE sql statement, then
you can import the data.

Peter

ok here is my xml file and I create my table like this

Cmd.CommandText = "CREATE TABLE T_EQUI (" & _
"TEQ_ID int NOT NULL ," & _
"TEQ_LIBELLE nvarchar (50) NULL)"
Cmd.ExecuteNonQuery()
Cmd.CommandText = "ALTER TABLE T_EQUI ADD CONSTRAINT PK_T_EQUI
PRIMARY KEY (TEQ_ID)"
Cmd.ExecuteNonQuery()


So waht code must I write to load the XML data into my SQLCE table
"T_EQUI" ?

Thanks
 
A

Amirallia

Peter Foot [MVP] avait soumis l'idée :
You will need to create the tables in your database. There is no automatic
way to do this, so you'll have to example the tables in the dataset,
enumerate their columns and piece together a CREATE TABLE sql statement, then
you can import the data.

Peter

ok here is my xml file and I create my table like this

Cmd.CommandText = "CREATE TABLE T_EQUI (" & _
"TEQ_ID int NOT NULL ," & _
"TEQ_LIBELLE nvarchar (50) NULL)"
Cmd.ExecuteNonQuery()
Cmd.CommandText = "ALTER TABLE T_EQUI ADD CONSTRAINT PK_T_EQUI
PRIMARY KEY (TEQ_ID)"
Cmd.ExecuteNonQuery()


So waht code must I write to load the XML data into my SQLCE table
"T_EQUI" ?

Thanks
 

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

Similar Threads


Top