Re: xml, sql mobile and server 2005
- From: "Mark Davis" <Mark@xxxxxxxx>
- Date: Mon, 11 Sep 2006 16:04:02 +0100
never mind,
I sussed it. I was calling AcceptChanges a bit too early in the process
Thanks anyway
:-)
"Mark Davis" <Mark@xxxxxxxx> wrote in message
news:%23IiH$zZ1GHA.328@xxxxxxxxxxxxxxxxxxxxxxx
Hi all,
I am struggling to getwhat i thought wiould be a simple solution working.
I have a Windows Mobile application that uses a database. I need to pull
data from it in xml format so I use a little loop on the table names to
craete xml files:
foreach (string tablename in _UploadTablesList)
{
this.database.Tables[tablename].WriteXML("\\" + tablename + ".xml",
XmlWriteMode.IgnoreSchema, false)
}
// database is a dataset automatically generated within vs2005
this works great and I get some nice xml files on mp mobile device.
I also need to import these xml files into sql server 2000 and 2005. This
is the part I am having trouble with.
In a PC program I create a new dataset, perform read xml, then use a Merge
command on my vs2005 generated dataset. (pc this time).
Depending on whether schema info is included on the wm5 side, I can either
see the records in the updated dataset, but i am unable to get them to
write to the sql database (no schema), or the merge fails saying that the
datetime column has a different type (with schema). However the tables
have identical structure:
mobile database:
CREATE TABLE [EventLog](
[HHID] [nvarchar](10) NOT NULL,
[PACode] [nvarchar](10) NULL,
[LocationCode] [nvarchar](10) NULL,
[EventType] [nvarchar](10) NULL,
[Comments] [nvarchar](100) NULL,
[CreateDateTime] [datetime] NOT NULL,
CONSTRAINT [PK_EventLog] PRIMARY KEY
(
[HHID],
[CreateDateTime]
)
);
server database
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id =
OBJECT_ID(N'[dbo].[CLinkCE2_EventLog]') AND type in (N'U'))
BEGIN
CREATE TABLE [dbo].[EventLog](
[HHID] [varchar](10) NOT NULL,
[PACode] [varchar](10) NULL,
[LocationCode] [varchar](10) NULL,
[EventType] [varchar](10) NULL,
[Comments] [varchar](100) NULL,
[CreateDateTime] [datetime] NOT NULL,
CONSTRAINT [PK_EventLog] PRIMARY KEY CLUSTERED
(
[HHID] ASC,
[CreateDateTime] ASC
)WITH (PAD_INDEX = OFF, IGNORE_DUP_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
END
Can anybody give me some hints?
TIA
Mark
.
- References:
- xml, sql mobile and server 2005
- From: Mark Davis
- xml, sql mobile and server 2005
- Prev by Date: problems with annotated mapping schema xsd
- Next by Date: HELP! for xml explicit doing strange things
- Previous by thread: xml, sql mobile and server 2005
- Next by thread: problems with annotated mapping schema xsd
- Index(es):
Relevant Pages
|