do it in database layer or application layer

G

Guest

Hi all,

I don't know how people deal with the issue in aspx pages:

Let's say you have a transaction through your aspx pages, in your
application program, you need to call different store procedures to insert
data to different tables. In case there is one store procedure call failed,
what would you do to other tables' data which already successfully insert
data to them?

It seems that you can create one store procedure to call all those store
procedures in database layer , in case one fails and you can rollback the
transactions,but it will have to pass to many parameters to that store
procedure, besides, what about you need to call one procedure many times
based on the application, (insert multiple rows to one table)?

In aspx page, what should I do, any special tech could make this one easy?

Any comments?
 
K

Karl Seguin [MVP]

Well, you can use the SqlTransaction within your data access layer to roll
back or commit. Your question is very vague because a lot of factors come
into play. Performance is a big one, your single call will cause let network
traffic, so that's good, but it'll be harder to maintain, that's bad. The
new capabilities of the Transcation objects in ADO.NET 2.0 are pretty sweet
too :)

Personally, I'd use the SqlTransaction object over multiple calls, and only
merge those calls if necessary (ie, too slow).

Karl
 
G

Guest

Karl,
I read the post in google newsgroup as you recommended, it's clearer and
easier.
But I need to reply you in this microsoft managed newsgroup in order to be
identified to be one perosn.
I will take your suggestion and will use sqltransaction object. I will have
leason now.
 
K

Karl Seguin [MVP]

Actually, I don't think I ever recommended google newsgroups, I just
mentioned it as an alternative.

I use outlook express which directly feeds into the NNTP protocol without
any fancy web interfaces.

I think you should use whatever tool you feel most comfortable with :)

Cheers,
karl
 

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

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,537
Members
45,021
Latest member
AkilahJaim

Latest Threads

Top