Re: xml, sql mobile and server 2005

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



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






.



Relevant Pages

  • How to upload Dataset read from XML to SQL Server Database
    ... I want to import XML files ... SQLXMLBulkLoad is useless since, our schema doesn't have ... But I could read schema and xml file in dataset without problem. ... only quesiton is how to insert this dataset in database. ...
    (microsoft.public.dotnet.framework.adonet)
  • Re: How to upload Dataset read from XML to SQL Server Database
    ... I want to import XML files ... SQLXMLBulkLoad is useless since, our schema doesn't have ... But I could read schema and xml file in dataset without problem. ... only quesiton is how to insert this dataset in database. ...
    (microsoft.public.dotnet.framework.adonet)
  • xml, sql mobile and server 2005
    ... have a Windows Mobile application that uses a database. ... this works great and I get some nice xml files on mp mobile device. ... CONSTRAINT PRIMARY KEY CLUSTERED ...
    (microsoft.public.sqlserver.xml)
  • Unable to Update A Table Schema Progmatically
    ... I have been struggling trying to update the schema of a database. ... I am trying to do is set the primary key of a table. ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: Looking for ORM for legacy database.
    ... table 'products' in anticipation of using Rails with it one day, ... Rails expects that the primary key is called ... It's not actually a pre-existing database. ... they run manually to make schema changes. ...
    (comp.lang.ruby)