A
Author #1
I quite often need to call a bunch of stored procedures to get data
for a few server controls in a single aspx page.
I think it gives better performance if I call these stored procedures
in one db trip instead of one db trip for each of these stored
procedure.
Note: I don't want to write a wrapper stored procedure to wrap up
these stored procedures, and then call this wrapper stored procedure
in the front end.
Can I use TransactionScope? If I wrap up my sproc calls in a
TransactionScope, does it make sure that all stored procedures are
called in one db trip? See below:
using (System.Transactions.TransactionScope xScope = new
System.Transactions.TransactionScope())
{
int customerId = Convert.ToInt32(Request["cid"]);
DataSet ds1 = GetCustomerDetails(customerId);
DataSet ds2 = GetOrderHistory(customerId);
int productId = Convert.ToInt32(Request["pid"]);
DataSet ds3 = GetProductInfo(productId);
}
1) Does this TransactionScope block ensure sproc calls in one db
trip?
2) All I do in this block of code is SELECT, no INSERT, UPDATE,
DELETE, does it make sense to wrap them up in a TransactionScope?
Thank you for your hint.
for a few server controls in a single aspx page.
I think it gives better performance if I call these stored procedures
in one db trip instead of one db trip for each of these stored
procedure.
Note: I don't want to write a wrapper stored procedure to wrap up
these stored procedures, and then call this wrapper stored procedure
in the front end.
Can I use TransactionScope? If I wrap up my sproc calls in a
TransactionScope, does it make sure that all stored procedures are
called in one db trip? See below:
using (System.Transactions.TransactionScope xScope = new
System.Transactions.TransactionScope())
{
int customerId = Convert.ToInt32(Request["cid"]);
DataSet ds1 = GetCustomerDetails(customerId);
DataSet ds2 = GetOrderHistory(customerId);
int productId = Convert.ToInt32(Request["pid"]);
DataSet ds3 = GetProductInfo(productId);
}
1) Does this TransactionScope block ensure sproc calls in one db
trip?
2) All I do in this block of code is SELECT, no INSERT, UPDATE,
DELETE, does it make sense to wrap them up in a TransactionScope?
Thank you for your hint.