SqlDataAdapter

D

DaveL

c# 2.0, etc, sql server 2005

i have a situation where i will be joing 3 tables in a proc
to return a row set of data to be verified by a windows service.

example:
Select m.TransactionId, m.Statusid,m.Field1,m.Field2,c1.field1,c2.field2
from myMaster m (nolock)
join child1 c1 (nolock) on c1.rowid = m.rowid
join child2 c2 (nolock) on c2.rowid =c1.rowid
where m.TransactionId = 99999999

the above is in a Proc.....along with the columns being returnd. When a
invalid row is determined
i will be changing a Statusid to be updated back at the server

i want to issue a SqlAdapter.update() , but i believe sqlAdapter does not
work for this type of Returnd row set...

so i was thinking of returning a second rows set with the transactionid and
statusid of the mymaster table this is all that needs to be updated

so a Additional select will be involved, and my windows service will
validate rowset 1 and update rowset 2 for updating the actual table
with a sqladapter update

Example
--// data to be validated
Select m.transactionId,m.Field1,m.Field2,c1.field1,c2.field2 from myMaster
m (nolock)
join child1 c1 (nolock) on c1.rowid = m.rowid
join child2 c2 (nolock) on c2.rowid =c1.rowid
where m.TransactionId = 99999999

// used with sqldataAdapter on return of data to mymaster table
select m.TransactionId,m.Statusid from mymaster (nolock) where
m.transactionid= 99999999

//i could have up to 5000 rows, and want to do a batch update instead of
some other slow update

Your thoughts please
Thanks
DaveL
 
F

Frank Uray

Hi Dave

As you wrote DataAdapter will not work on a Stored Procedure.
I would create a DataSet with your 3 tables and with the
relations set. Than you can fill the DataSet and you will be
able to use the DataAdapter.Update.

Hope this helps
Regards
Frank
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top