PC Review


Reply
Thread Tools Rate Thread

datasets over webservice / size

 
 
Florian Lutz
Guest
Posts: n/a
 
      20th Dec 2004
Hello,
i have a simple Webservice, that gives me some data from a sql database
as a DataSet. On the pocketpc i modify that dataset and write it back
to the sqldb (via a webservice). my questions: is there a way to get
the size of the data thats being send back? are only modified values
send back to the webservice?

thanks
florian

 
Reply With Quote
 
 
 
 
Jan Yeh_eMVP
Guest
Posts: n/a
 
      20th Dec 2004
Hi, florian

From your scenario, you might have 2 web methods in your web service.
One is for pull down data from SQL Server, and the other is for send back
data into SQL Server.

For example, if you pull down large data, and modify 3 rows of records
from the dataset, you can just send the 3 rows back to server( carried in
another dataset), instead of sending the whole dataset.

--

Best Regards,

Jan Yeh
MVP - Windows CE.NET, MCSD.NET, .NETcf consultant
Web - http://www.mobilemind.com.tw , Blog - http://blog.mvpcn.net/janyeh

"Florian Lutz" <(E-Mail Removed)> 撰寫於郵件新聞:(E-Mail Removed)...
> Hello,
> i have a simple Webservice, that gives me some data from a sql database
> as a DataSet. On the pocketpc i modify that dataset and write it back
> to the sqldb (via a webservice). my questions: is there a way to get
> the size of the data thats being send back? are only modified values
> send back to the webservice?
>
> thanks
> florian
>



 
Reply With Quote
 
Ilya Tumanov [MS]
Guest
Posts: n/a
 
      21st Dec 2004
No, DataSet does not know WS has some data already (in fact it has no idea
where data came from), so I sends everything.

In desktop framework you can use DataSet.GetChanges() to get modified rows.
This method is unavailable in CF V1 (available in CF V2), however.

You can easily create a workaround:

1. Clone the DataSet (won't copy data, just schema).
2. For each DataTable in DataSet
3. For each DataRow in DataTable
4. Check DataRowState
5. If it's not Unchanged, add it to cloned table.
6. Send cloned DataSet which now contains changed data.

Alternatively, you could use SQL Client to interact with SQL Server
database directly.
That would be significantly faster than WS and would only update changed
rows for you without extra work on your side.

Best regards,

Ilya

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

--------------------
> From: "Florian Lutz" <(E-Mail Removed)>
> Newsgroups: microsoft.public.dotnet.framework.compactframework
> Subject: datasets over webservice / size
> Date: 20 Dec 2004 00:32:45 -0800
> Organization: http://groups.google.com
> Lines: 10
> Message-ID: <(E-Mail Removed)>
> NNTP-Posting-Host: 203.217.8.66
> Mime-Version: 1.0
> Content-Type: text/plain; charset="iso-8859-1"
> X-Trace: posting.google.com 1103531570 12908 127.0.0.1 (20 Dec 2004

08:32:50 GMT)
> X-Complaints-To: groups-(E-Mail Removed)
> NNTP-Posting-Date: Mon, 20 Dec 2004 08:32:50 +0000 (UTC)
> User-Agent: G2/0.2
> Complaints-To: groups-(E-Mail Removed)
> Injection-Info: c13g2000cwb.googlegroups.com; posting-host=203.217.8.66;
> posting-account=p47-Lg0AAAAhHq7M5IcRlr6CsUsxa6tD
> Path:

cpmsftngxa10.phx.gbl!TK2MSFTFEED02.phx.gbl!TK2MSFTNGP08.phx.gbl!newsfeed00.s
ul.t-online.de!t-online.de!news.glorb.com!postnews.google.com!c13g2000cwb.go
oglegroups.com!not-for-mail
> Xref: cpmsftngxa10.phx.gbl

microsoft.public.dotnet.framework.compactframework:67223
> X-Tomcat-NG: microsoft.public.dotnet.framework.compactframework
>
> Hello,
> i have a simple Webservice, that gives me some data from a sql database
> as a DataSet. On the pocketpc i modify that dataset and write it back
> to the sqldb (via a webservice). my questions: is there a way to get
> the size of the data thats being send back? are only modified values
> send back to the webservice?
>
> thanks
> florian
>
>


 
Reply With Quote
 
Florian Lutz
Guest
Posts: n/a
 
      22nd Dec 2004
Hello Ilya,

when i save the dataset to my device (ds.WriteXml(...) and
ds.WriteXmlSchema(...)), read it again
(someOtherDataSet.readXmlSchema(...) and someOtherDataSet.readXml(...))
and then then try to send the new dataset to my webservice i get a
"Violation of Primary Key constraint 'pk_test'. Cannot insert duplicate
key in object 'test'."
strangely enough i don't get that error if i send the original
in-memory dataset back. what is the difference. how can i solve this?
florian

 
Reply With Quote
 
Ilya Tumanov [MS]
Guest
Posts: n/a
 
      22nd Dec 2004
You mean, exception on a desktop while trying to receive data from device?
Do you have hidden autoincrement primary key?

Best regards,

Ilya

This posting is provided "AS IS" with no warranties, and confers no rights.
--------------------
> From: "Florian Lutz" <(E-Mail Removed)>
> Newsgroups: microsoft.public.dotnet.framework.compactframework
> Subject: Re: datasets over webservice / size
> Date: 21 Dec 2004 19:30:40 -0800
> Organization: http://groups.google.com
> Lines: 12
> Message-ID: <(E-Mail Removed)>
> References: <(E-Mail Removed)>
> <(E-Mail Removed)>
> NNTP-Posting-Host: 203.217.8.66
> Mime-Version: 1.0
> Content-Type: text/plain; charset="iso-8859-1"
> X-Trace: posting.google.com 1103686244 29604 127.0.0.1 (22 Dec 2004

03:30:44 GMT)
> X-Complaints-To: groups-(E-Mail Removed)
> NNTP-Posting-Date: Wed, 22 Dec 2004 03:30:44 +0000 (UTC)
> In-Reply-To: <(E-Mail Removed)>
> User-Agent: G2/0.2
> Complaints-To: groups-(E-Mail Removed)
> Injection-Info: c13g2000cwb.googlegroups.com; posting-host=203.217.8.66;
> posting-account=p47-Lg0AAAAhHq7M5IcRlr6CsUsxa6tD
> Path:

cpmsftngxa10.phx.gbl!TK2MSFTNGXA01.phx.gbl!cpmsftngxa06.phx.gbl!TK2MSFTNGP08
.phx.gbl!news-out.cwix.com!newsfeed.cwix.com!border1.nntp.dca.giganews.com!n
ntp.giganews.com!news.glorb.com!postnews.google.com!c13g2000cwb.googlegroups
.com!not-for-mail
> Xref: cpmsftngxa10.phx.gbl

microsoft.public.dotnet.framework.compactframework:67382
> X-Tomcat-NG: microsoft.public.dotnet.framework.compactframework
>
> Hello Ilya,
>
> when i save the dataset to my device (ds.WriteXml(...) and
> ds.WriteXmlSchema(...)), read it again
> (someOtherDataSet.readXmlSchema(...) and someOtherDataSet.readXml(...))
> and then then try to send the new dataset to my webservice i get a
> "Violation of Primary Key constraint 'pk_test'. Cannot insert duplicate
> key in object 'test'."
> strangely enough i don't get that error if i send the original
> in-memory dataset back. what is the difference. how can i solve this?
> florian
>
>


 
Reply With Quote
 
Florian Lutz
Guest
Posts: n/a
 
      23rd Dec 2004
the webservice reports this exception back to the pocketpc client (i
just paste the exception back as a string)
> Do you have hidden autoincrement primary key?

you mean in the DB? how can i find out?

florian

 
Reply With Quote
 
Ilya Tumanov [MS]
Guest
Posts: n/a
 
      23rd Dec 2004
I see...

As to primary key, I meant in DataSet (which should be a reflection of your
DB).
To find out if you have a hidden autoincrement key, you can do something
like this:

foreach(DataTable dt in dataSet) {
foreach (DataColumn dc in dt) {
if (( dc.ColumnMapping == MappingType.Hidden) && dc.AutoIncrement) {
Console.WriteLine ("Got hidden autoincrement column '{0}'",
dc.ColumnName);
}
}
}

If you do, I suspect that information might be lost as it's not saved to
XML (since it's hidden).
You could you also try saving XML in diffgram format, that should preserve
hidden columns (WS uses diffgram format).

And, by the way, could you please post some code from WS side? Thanks.

Best regards,

Ilya

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

--------------------
> From: "Florian Lutz" <(E-Mail Removed)>
> Newsgroups: microsoft.public.dotnet.framework.compactframework
> Subject: Re: datasets over webservice / size
> Date: 22 Dec 2004 18:40:29 -0800
> Organization: http://groups.google.com
> Lines: 7
> Message-ID: <(E-Mail Removed)>
> References: <(E-Mail Removed)>
> <(E-Mail Removed)>
> <(E-Mail Removed)>
> NNTP-Posting-Host: 203.217.8.66
> Mime-Version: 1.0
> Content-Type: text/plain; charset="iso-8859-1"
> X-Trace: posting.google.com 1103769633 30504 127.0.0.1 (23 Dec 2004

02:40:33 GMT)
> X-Complaints-To: groups-(E-Mail Removed)
> NNTP-Posting-Date: Thu, 23 Dec 2004 02:40:33 +0000 (UTC)
> In-Reply-To: <(E-Mail Removed)>
> User-Agent: G2/0.2
> Complaints-To: groups-(E-Mail Removed)
> Injection-Info: f14g2000cwb.googlegroups.com; posting-host=203.217.8.66;
> posting-account=p47-Lg0AAAAhHq7M5IcRlr6CsUsxa6tD
> Path:

cpmsftngxa10.phx.gbl!TK2MSFTFEED02.phx.gbl!TK2MSFTNGP08.phx.gbl!newsfeed00.s
ul.t-online.de!t-online.de!news.glorb.com!postnews.google.com!f14g2000cwb.go
oglegroups.com!not-for-mail
> Xref: cpmsftngxa10.phx.gbl

microsoft.public.dotnet.framework.compactframework:67449
> X-Tomcat-NG: microsoft.public.dotnet.framework.compactframework
>
> the webservice reports this exception back to the pocketpc client (i
> just paste the exception back as a string)
> > Do you have hidden autoincrement primary key?

> you mean in the DB? how can i find out?
>
> florian
>
>


 
Reply With Quote
 
Florian Lutz
Guest
Posts: n/a
 
      28th Dec 2004
hello Ilya,

there is no hidden autoincrement key in my dataset. saving the dataset
as a diffgram works excellent.
i found something else:
when i copy all modified rows to a new dataset, their rowstate becomes
"inserted" (checked the local diffgram xml copy)
uploading them causes a primary key constraint violation (makes sense,
they are "inserted" so uploading them would create a copy with the same
primary key)
calling a acceptchanges on the dataset that contains the changed rows,
removes the "inserted" state. an upload works, however the update
method returns 0 updated rows. no updates on the server side.
manually setting them to "modified" seems not possible (cannot change
the rowstate manually)

so i guess i have to change something on the server...? the setup there
relatively simple, just a database and i used the vs.net2003 wizard to
create a data adapter.
the only thing that makes me wonder is the following (autogenerated)
code:

this.sqlUpdateCommand1.CommandText = @"UPDATE manifest SET id = @id,
cash = @cash, signature = @signature, WHERE (id = @Original_id)";
this.sqlUpdateCommand1.Connection = this.sqlConnection1;
this.sqlUpdateCommand1.Parameters.Add(new
System.Data.SqlClient.SqlParameter("@id", System.Data.SqlDbType.BigInt,
8, "id"));
this.sqlUpdateCommand1.Parameters.Add(new
System.Data.SqlClient.SqlParameter("@cash", System.Data.SqlDbType.Bit,
1, "cash"));
this.sqlUpdateCommand1.Parameters.Add(new
System.Data.SqlClient.SqlParameter("@signature",
System.Data.SqlDbType.VarBinary, 2147483647, "signature"));
this.sqlUpdateCommand1.Parameters.Add(new
System.Data.SqlClient.SqlParameter("@Original_id",
System.Data.SqlDbType.BigInt, 8, System.Data.ParameterDirection.Input,
false, ((System.Byte)(0)), ((System.Byte)(0)), "id",
System.Data.DataRowVersion.Original, null));
whatis the original id?

florian

 
Reply With Quote
 
Ilya Tumanov [MS]
Guest
Posts: n/a
 
      28th Dec 2004
I see... Well, if you need to preserve a row state, you can use diffgram
format for storage.
Or, you can merge original DataSet with DataSet from device on the server
and submit merged result to SQL.

Best regards,

Ilya

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

--------------------
> From: "Florian Lutz" <(E-Mail Removed)>
> Newsgroups: microsoft.public.dotnet.framework.compactframework
> Subject: Re: datasets over webservice / size
> Date: 27 Dec 2004 22:02:38 -0800
> Organization: http://groups.google.com
> Lines: 43
> Message-ID: <(E-Mail Removed)>
> References: <(E-Mail Removed)>
> <(E-Mail Removed)>
> <(E-Mail Removed)>
> NNTP-Posting-Host: 203.217.8.66
> Mime-Version: 1.0
> Content-Type: text/plain; charset="iso-8859-1"
> X-Trace: posting.google.com 1104213763 12399 127.0.0.1 (28 Dec 2004

06:02:43 GMT)
> X-Complaints-To: groups-(E-Mail Removed)
> NNTP-Posting-Date: Tue, 28 Dec 2004 06:02:43 +0000 (UTC)
> In-Reply-To: <(E-Mail Removed)>
> User-Agent: G2/0.2
> Complaints-To: groups-(E-Mail Removed)
> Injection-Info: f14g2000cwb.googlegroups.com; posting-host=203.217.8.66;
> posting-account=p47-Lg0AAAAhHq7M5IcRlr6CsUsxa6tD
> Path:

cpmsftngxa10.phx.gbl!TK2MSFTNGXA06.phx.gbl!cpmsftngxa06.phx.gbl!TK2MSFTNGP08
phx.gbl!newsfeed00.sul.t-online.de!t-online.de!border2.nntp.dca.giganews.co
m!nntp.giganews.com!wns14feed!worldnet.att.net!209.244.4.230!newsfeed1.dalla
s1.level3.net!newsfeed2.dallas1.level3.net!news.level3.com!postnews.google.c
om!f14g2000cwb.googlegroups.com!not-for-mail
> Xref: cpmsftngxa10.phx.gbl

microsoft.public.dotnet.framework.compactframework:67610
> X-Tomcat-NG: microsoft.public.dotnet.framework.compactframework
>
> hello Ilya,
>
> there is no hidden autoincrement key in my dataset. saving the dataset
> as a diffgram works excellent.
> i found something else:
> when i copy all modified rows to a new dataset, their rowstate becomes
> "inserted" (checked the local diffgram xml copy)
> uploading them causes a primary key constraint violation (makes sense,
> they are "inserted" so uploading them would create a copy with the same
> primary key)
> calling a acceptchanges on the dataset that contains the changed rows,
> removes the "inserted" state. an upload works, however the update
> method returns 0 updated rows. no updates on the server side.
> manually setting them to "modified" seems not possible (cannot change
> the rowstate manually)
>
> so i guess i have to change something on the server...? the setup there
> relatively simple, just a database and i used the vs.net2003 wizard to
> create a data adapter.
> the only thing that makes me wonder is the following (autogenerated)
> code:
>
> this.sqlUpdateCommand1.CommandText = @"UPDATE manifest SET id = @id,
> cash = @cash, signature = @signature, WHERE (id = @Original_id)";
> this.sqlUpdateCommand1.Connection = this.sqlConnection1;
> this.sqlUpdateCommand1.Parameters.Add(new
> System.Data.SqlClient.SqlParameter("@id", System.Data.SqlDbType.BigInt,
> 8, "id"));
> this.sqlUpdateCommand1.Parameters.Add(new
> System.Data.SqlClient.SqlParameter("@cash", System.Data.SqlDbType.Bit,
> 1, "cash"));
> this.sqlUpdateCommand1.Parameters.Add(new
> System.Data.SqlClient.SqlParameter("@signature",
> System.Data.SqlDbType.VarBinary, 2147483647, "signature"));
> this.sqlUpdateCommand1.Parameters.Add(new
> System.Data.SqlClient.SqlParameter("@Original_id",
> System.Data.SqlDbType.BigInt, 8, System.Data.ParameterDirection.Input,
> false, ((System.Byte)(0)), ((System.Byte)(0)), "id",
> System.Data.DataRowVersion.Original, null));
> whatis the original id?
>
> florian
>
>


 
Reply With Quote
 
Jan Yeh_eMVP
Guest
Posts: n/a
 
      30th Dec 2004
Hello, Florian

If you want to make your dataset with "modified" rowstate,
you can change the row data with the same value, that will make it
"modified"
without changing your data.

For example,
for(int i=0; i<dataTable.Rows.Count; i++)
{
dataTable.Rows[0].Value = dataTable.Rows[0].Value;
}

--

Best Regards,

Jan Yeh
MVP - Windows CE.NET, MCSD.NET, .NETcf consultant
Web - http://www.mobilemind.com.tw , Blog - http://blog.mvpcn.net/janyeh

"Florian Lutz" <(E-Mail Removed)> 撰寫於郵件新聞:(E-Mail Removed)...
> hello Ilya,
>
> there is no hidden autoincrement key in my dataset. saving the dataset
> as a diffgram works excellent.
> i found something else:
> when i copy all modified rows to a new dataset, their rowstate becomes
> "inserted" (checked the local diffgram xml copy)
> uploading them causes a primary key constraint violation (makes sense,
> they are "inserted" so uploading them would create a copy with the same
> primary key)
> calling a acceptchanges on the dataset that contains the changed rows,
> removes the "inserted" state. an upload works, however the update
> method returns 0 updated rows. no updates on the server side.
> manually setting them to "modified" seems not possible (cannot change
> the rowstate manually)
>
> so i guess i have to change something on the server...? the setup there
> relatively simple, just a database and i used the vs.net2003 wizard to
> create a data adapter.
> the only thing that makes me wonder is the following (autogenerated)
> code:
>
> this.sqlUpdateCommand1.CommandText = @"UPDATE manifest SET id = @id,
> cash = @cash, signature = @signature, WHERE (id = @Original_id)";
> this.sqlUpdateCommand1.Connection = this.sqlConnection1;
> this.sqlUpdateCommand1.Parameters.Add(new
> System.Data.SqlClient.SqlParameter("@id", System.Data.SqlDbType.BigInt,
> 8, "id"));
> this.sqlUpdateCommand1.Parameters.Add(new
> System.Data.SqlClient.SqlParameter("@cash", System.Data.SqlDbType.Bit,
> 1, "cash"));
> this.sqlUpdateCommand1.Parameters.Add(new
> System.Data.SqlClient.SqlParameter("@signature",
> System.Data.SqlDbType.VarBinary, 2147483647, "signature"));
> this.sqlUpdateCommand1.Parameters.Add(new
> System.Data.SqlClient.SqlParameter("@Original_id",
> System.Data.SqlDbType.BigInt, 8, System.Data.ParameterDirection.Input,
> false, ((System.Byte)(0)), ((System.Byte)(0)), "id",
> System.Data.DataRowVersion.Original, null));
> whatis the original id?
>
> florian
>



 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
webservice and typed datasets Mike Microsoft C# .NET 3 5th Dec 2006 08:19 AM
Loading DataSets and App Size Paul Microsoft VB .NET 4 30th Sep 2005 02:57 PM
WebService Parameter Size Limit and Impact! Vai2000 Microsoft C# .NET 4 3rd Aug 2004 04:20 PM
WebService & Datasets a Microsoft Dot NET Framework Forms 3 6th May 2004 07:59 AM
Can I use a WebService Architecture to transfer large datasets ? Sanjay Microsoft ASP .NET 0 20th Nov 2003 04:32 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 06:15 PM.