Ado.Net and COM+

B

Barbelith

Hello

I'm pretty new to ADO.Net and I'm still a little confused about some
things, I hope I can make myself clear.

I'm writing a data-centric web application using ASP.Net, based on a
SQL Server 2000 database.

I have a table called Person that I'll take as an example of how I
access data.

I build a dataadapter that access a stored procedure and returns the
data into a dataset.

i take the datatable and pass it to a custom business object that i
use as a PersonCollection.

If I want a certain person i query the table and return a datarow that
I wrap inside a custon Person object, with properties that wrap the
datarow fields.

What i want wo know is: how do I update 2 or three of my wrapped
tables inside the same transaction using COM+?
I'm a litte confused about this.
I can update the fields inside the datarows and the write back the
changes using a dataadapter using its Updatestatement.
But as far as I know a COM+ transaction abort will not affect the
datarows rowstate attributes.

I'm not sure I make mayself clear here, I guess I'm just looking for
beste practices to update several datatables inside the same
transaction using COM+, maybe someone knows what I'm talkong about and
can help

Thanks in advance,
PL
 
P

Paul Clement

¤
¤
¤ Hello
¤
¤ I'm pretty new to ADO.Net and I'm still a little confused about some
¤ things, I hope I can make myself clear.
¤
¤ I'm writing a data-centric web application using ASP.Net, based on a
¤ SQL Server 2000 database.
¤
¤ I have a table called Person that I'll take as an example of how I
¤ access data.
¤
¤ I build a dataadapter that access a stored procedure and returns the
¤ data into a dataset.
¤
¤ i take the datatable and pass it to a custom business object that i
¤ use as a PersonCollection.
¤
¤ If I want a certain person i query the table and return a datarow that
¤ I wrap inside a custon Person object, with properties that wrap the
¤ datarow fields.
¤
¤ What i want wo know is: how do I update 2 or three of my wrapped
¤ tables inside the same transaction using COM+?
¤ I'm a litte confused about this.
¤ I can update the fields inside the datarows and the write back the
¤ changes using a dataadapter using its Updatestatement.
¤ But as far as I know a COM+ transaction abort will not affect the
¤ datarows rowstate attributes.
¤
¤ I'm not sure I make mayself clear here, I guess I'm just looking for
¤ beste practices to update several datatables inside the same
¤ transaction using COM+, maybe someone knows what I'm talkong about and
¤ can help

I would recommend reading the documentation so that you understand how serviced components operate.
Keep in mind that COM+ maintains the context and as long as the context is implemented properly you
should be able to rollback (SetAbort) multiple dependent updates.

http://msdn.microsoft.com/library/d...guide/html/cpconservicedcomponentoverview.asp


Paul ~~~ (e-mail address removed)
Microsoft MVP (Visual Basic)
 
B

Barbelith

¤
¤
¤ Hello
¤
¤ I'm pretty new to ADO.Net and I'm still a little confused about some
¤ things, I hope I can make myself clear.
¤
¤ I'm writing a data-centric web application using ASP.Net, based on a
¤ SQL Server 2000 database.
¤
¤ I have a table called Person that I'll take as an example of how I
¤ access data.
¤
¤ I build a dataadapter that access a stored procedure and returns the
¤ data into a dataset.
¤
¤ i take the datatable and pass it to a custom business object that i
¤ use as a PersonCollection.
¤
¤ If I want a certain person i query the table and return a datarow that
¤ I wrap inside a custon Person object, with properties that wrap the
¤ datarow fields.
¤
¤ What i want wo know is: how do I update 2 or three of my wrapped
¤ tables inside the same transaction using COM+?
¤ I'm a litte confused about this.
¤ I can update the fields inside the datarows and the write back the
¤ changes using a dataadapter using its Updatestatement.
¤ But as far as I know a COM+ transaction abort will not affect the
¤ datarows rowstate attributes.
¤
¤ I'm not sure I make mayself clear here, I guess I'm just looking for
¤ beste practices to update several datatables inside the same
¤ transaction using COM+, maybe someone knows what I'm talkong about and
¤ can help

I would recommend reading the documentation so that you understand how serviced components operate.
Keep in mind that COM+ maintains the context and as long as the context is implemented properly you
should be able to rollback (SetAbort) multiple dependent updates.

http://msdn.microsoft.com/library/d...guide/html/cpconservicedcomponentoverview.asp


Paul ~~~ (e-mail address removed)
Microsoft MVP (Visual Basic)

Thing is, i know how COM+ transactions work.
I know that an aborted transaction will roll back all changes to the
database(s) inside the same transaction.
What I DON'T know is how this will effect the rowstate inside the
datatable/set.

Say I want to update two datatables inside a transaction using the
dataset's update method.

Table 1 successfully updates and, I would think, calls AcceptChanges()
on all affected rows.

Table 2 throws an error and causes a database rollback.
What will happen to the datarows inside table 1?
Will their values also be rolled back or do I have to undo all changes
by hand?

I'm really, REALLY trying to figure this out myself but I can't find
anything about this stuff, so any help here is really appreciated.

PL
 
P

Paul Clement

¤ >
¤ >I would recommend reading the documentation so that you understand how serviced components operate.
¤ >Keep in mind that COM+ maintains the context and as long as the context is implemented properly you
¤ >should be able to rollback (SetAbort) multiple dependent updates.
¤ >
¤ >http://msdn.microsoft.com/library/d...guide/html/cpconservicedcomponentoverview.asp
¤ >
¤ >
¤ >Paul ~~~ (e-mail address removed)
¤ >Microsoft MVP (Visual Basic)
¤
¤ Thing is, i know how COM+ transactions work.
¤ I know that an aborted transaction will roll back all changes to the
¤ database(s) inside the same transaction.
¤ What I DON'T know is how this will effect the rowstate inside the
¤ datatable/set.
¤
¤ Say I want to update two datatables inside a transaction using the
¤ dataset's update method.
¤
¤ Table 1 successfully updates and, I would think, calls AcceptChanges()
¤ on all affected rows.
¤
¤ Table 2 throws an error and causes a database rollback.
¤ What will happen to the datarows inside table 1?
¤ Will their values also be rolled back or do I have to undo all changes
¤ by hand?
¤
¤ I'm really, REALLY trying to figure this out myself but I can't find
¤ anything about this stuff, so any help here is really appreciated.

If you want to see whether the rollback affects the data in the datatable then I would suggest you
run a simple proof of concept.

I would also suggest the following KB article:

How To Roll Back Updates After an Error When You Use DataAdapter and DataSet in ADO.NET and Visual
Basic .NET
http://support.microsoft.com/default.aspx?scid=kb;en-us;310351


Paul ~~~ (e-mail address removed)
Microsoft MVP (Visual Basic)
 

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