Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Web Services > DataRow, WebService question

Reply
Thread Tools

DataRow, WebService question

 
 
Tim Mulholland
Guest
Posts: n/a
 
      08-07-2003
I am writing a WindowsForms based application that uses WebServices to add
records to a SQL Server database, and later query those, and other records.

My initial thought was to have one WebService return a new DataRow (having
gotten it by calling .NewRow() on a dataset), populate it, and then call
another WebService that accepts the full DataRow object and adds it to the
table.

I came to find out, DataRows are not serializable for WebServices. The MSDN
documentation said to always use a DataSet instead of a DataRow, DataTable,
etc. when working with WebServices.

This would seem to necessitate one of two things: 1) Returning the entire
DataSet (with thousands of records) from SQL Server, or 2) Creating a
temporary DataSet with the same structure and using a NewRow off of that.

#1 seems so inconvenient, that i'm sure #2 would be the best option. But in
my experience, if you create a row in one DataSet, and then try to do a
Rows.Add() to another DataSet, this generates an error saying that the row
already belongs to another table.

Am i missing something? Is there a way to change the table that a DataRow
object belongs to (assuming you're changing it to one with the same
structure)? Or is my approach here totally wrong and there's something alot
simpler?

Thanks in advance!

Tim


 
Reply With Quote
 
 
 
 
Tim Mulholland
Guest
Posts: n/a
 
      08-07-2003
No i hadn't looked into it - in fact, i had totally forgotten that it
existed.
Looking at the documentation, this looks like it would work perfectly - but
since i'm not sitting at the computer with the code on it, i'd like to just
verify something real quick if you dont mind:

I can create a dataset with the same schema in my webservice and return
that. Then, in my code i can add rows to it all i want (even multiple rows
if i felt like it). I can then pass that whole dataset back in through a
webservice and in that webservice, i can merge the data back together, and
update the physical table.
If that's all true, then that's wonderful.
Thanks alot Bill !

Tim

"Bill Simakis" <(E-Mail Removed)> wrote in message
news:%(E-Mail Removed)...
> Tim,
>
> For solution #2, have you tried using the DataSet Merge method?
>
> Bill
>
>
> "Tim Mulholland" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
> > I am writing a WindowsForms based application that uses WebServices to

add
> > records to a SQL Server database, and later query those, and other

> records.
> >
> > My initial thought was to have one WebService return a new DataRow

(having
> > gotten it by calling .NewRow() on a dataset), populate it, and then call
> > another WebService that accepts the full DataRow object and adds it to

the
> > table.
> >
> > I came to find out, DataRows are not serializable for WebServices. The

> MSDN
> > documentation said to always use a DataSet instead of a DataRow,

> DataTable,
> > etc. when working with WebServices.
> >
> > This would seem to necessitate one of two things: 1) Returning the

entire
> > DataSet (with thousands of records) from SQL Server, or 2) Creating a
> > temporary DataSet with the same structure and using a NewRow off of

that.
> >
> > #1 seems so inconvenient, that i'm sure #2 would be the best option. But

> in
> > my experience, if you create a row in one DataSet, and then try to do a
> > Rows.Add() to another DataSet, this generates an error saying that the

row
> > already belongs to another table.
> >
> > Am i missing something? Is there a way to change the table that a

DataRow
> > object belongs to (assuming you're changing it to one with the same
> > structure)? Or is my approach here totally wrong and there's something

> alot
> > simpler?
> >
> > Thanks in advance!
> >
> > Tim
> >
> >

>
>



 
Reply With Quote
 
 
 
 
Bill Simakis
Guest
Posts: n/a
 
      08-07-2003
Tim,

That is what the framework promises. I haven't tried it myself, I just
remembered reading about it when I was looking into solving another problem.

Bill

"Tim Mulholland" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> No i hadn't looked into it - in fact, i had totally forgotten that it
> existed.
> Looking at the documentation, this looks like it would work perfectly -

but
> since i'm not sitting at the computer with the code on it, i'd like to

just
> verify something real quick if you dont mind:
>
> I can create a dataset with the same schema in my webservice and return
> that. Then, in my code i can add rows to it all i want (even multiple rows
> if i felt like it). I can then pass that whole dataset back in through a
> webservice and in that webservice, i can merge the data back together, and
> update the physical table.
> If that's all true, then that's wonderful.
> Thanks alot Bill !
>
> Tim
>
> "Bill Simakis" <(E-Mail Removed)> wrote in message
> news:%(E-Mail Removed)...
> > Tim,
> >
> > For solution #2, have you tried using the DataSet Merge method?
> >
> > Bill
> >
> >
> > "Tim Mulholland" <(E-Mail Removed)> wrote in message
> > news:(E-Mail Removed)...
> > > I am writing a WindowsForms based application that uses WebServices to

> add
> > > records to a SQL Server database, and later query those, and other

> > records.
> > >
> > > My initial thought was to have one WebService return a new DataRow

> (having
> > > gotten it by calling .NewRow() on a dataset), populate it, and then

call
> > > another WebService that accepts the full DataRow object and adds it to

> the
> > > table.
> > >
> > > I came to find out, DataRows are not serializable for WebServices. The

> > MSDN
> > > documentation said to always use a DataSet instead of a DataRow,

> > DataTable,
> > > etc. when working with WebServices.
> > >
> > > This would seem to necessitate one of two things: 1) Returning the

> entire
> > > DataSet (with thousands of records) from SQL Server, or 2) Creating a
> > > temporary DataSet with the same structure and using a NewRow off of

> that.
> > >
> > > #1 seems so inconvenient, that i'm sure #2 would be the best option.

But
> > in
> > > my experience, if you create a row in one DataSet, and then try to do

a
> > > Rows.Add() to another DataSet, this generates an error saying that the

> row
> > > already belongs to another table.
> > >
> > > Am i missing something? Is there a way to change the table that a

> DataRow
> > > object belongs to (assuming you're changing it to one with the same
> > > structure)? Or is my approach here totally wrong and there's something

> > alot
> > > simpler?
> > >
> > > Thanks in advance!
> > >
> > > Tim
> > >
> > >

> >
> >

>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools

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
Problem to call a WEBSERVICE in another WEBSERVICE (AXIS/ TOMCAT) Cyril Java 2 06-01-2006 06:07 PM
Problem! webservice.htc calling nonsecure webservice from a secured ssl https webpage batista ASP .Net 1 01-26-2006 12:05 PM
Problem! webservice.htc calling nonsecure webservice from a secured ssl https webpage batista ASP .Net 0 01-26-2006 08:13 AM
WebService on Java server versus WebService on .NET Mr. x Java 2 10-09-2003 11:21 PM
use another webservice in a webservice Mr. x ASP .Net Web Services 0 09-26-2003 10:59 PM



Advertisments