Dmitry,
Plamen already got it, but you may have missed it. If you intialize your variables with null prior to the try/catch, it should still work.
SqlCommand sc = null;
DataReader dr = null;
try
{
sc = new SqlCommand();
}
catch (SqlException ex)
{
}
~~Bonnie
>>>>
>>Don't want to answer for Plamen, but you didn't get it right. You have to initialize all variables prior to try/finally block.
>
>That's not my understanding. The idea of TRY is to try to initialize things to see if they work and if they don't catch them. I know I have to declare them prior to TRY but it is different from initializing. Perhaps Plamen or Bonnie will correct me or you :-)