T
Tim Mulholland
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
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