Can two catch blocks be executed?

Answer Posted / khushnood alam

two catch block can be executed but need coresponding try
block
ex
DbTransaction Transaction = Connection.BeginTransaction();
try
{
RemoteDB.ExecuteNonQuery(cmdBfcNew,
Transaction);
if (Convert.ToInt64
(AddBfcNewOutgoingDetails["ID"]) == -1)
{
mID = Convert.ToInt64
(RemoteDB.GetParameterValue(cmdBfcNew, "@ReturnID"));
}
else
{
mID = Convert.ToInt64
(AddBfcNewOutgoingDetails["ID"]);
}
try
{
DbCommand cmdOutgoing =
LocalDB.GetStoredProcCommand
("usp_Outgoing2UpdateAfterUploadingData");
LocalDB.AddInParameter
(cmdOutgoing, "@AwbNo", DbType.String,
AddBfcNewOutgoingDetails["AwbNo"]);
}
catch (Exception Ex)
{
Transaction.Rollback();
Transaction1.Rollback();
return Ex.Message;
}
catch (Exception Ex)
{
Transaction.Rollback
();
return Ex.Message;
}

Is This Answer Correct ?    2 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What exactly happens when we debug and build the program?

1983


How do I simulate optional parameters to com calls?

499


What is predicate builder?

475


Why do you need boxing in c#?

488


What is the process of Serialization?

559






Explain manifest & metadata in c#.

531


How do I create a multi language, multi file assembly?

620


how to insert the data from the grid view to database table though button click.pls send the answer to mail id suri1319@gmail.com

1490


What is connection pooling in ado.net?

541


Is unity object oriented?

487


What are the types of parameters in c#?

522


Can I get the name of a type at runtime?

528


Is lazy thread safe c#?

500


How to transpose multi-dimensional array?

552


Where test director stores its data ? Database ,Local file etc...? I need to read this data from Visual Studio 2005 c# client. Regards

1470