T
tshad
If I have no Connection object defined (it is part of the SqlCommand
object), I assume I would need to close my connection using the
ExecuteNonQuery command. Would I do it like so?
SqlCommand dbCommand = null;
try
{
SqlCommand dbCommand = new SqlCommand("ReverseFileDetail",
new
SqlConnection(ConfigurationManager.ConnectionStrings["ConnectString"].ConnectionString));
dbCommand.CommandType = CommandType.StoredProcedure;
....
dbCommand.Connection.Open();
dbCommand.ExecuteNonQuery();
catch (Exception exc)
{
throw;
}
finally
{
if (dbCommand.Connection != null)
dbCommand.Connection.Close();
}
Thanks,
Tom
object), I assume I would need to close my connection using the
ExecuteNonQuery command. Would I do it like so?
SqlCommand dbCommand = null;
try
{
SqlCommand dbCommand = new SqlCommand("ReverseFileDetail",
new
SqlConnection(ConfigurationManager.ConnectionStrings["ConnectString"].ConnectionString));
dbCommand.CommandType = CommandType.StoredProcedure;
....
dbCommand.Connection.Open();
dbCommand.ExecuteNonQuery();
catch (Exception exc)
{
throw;
}
finally
{
if (dbCommand.Connection != null)
dbCommand.Connection.Close();
}
Thanks,
Tom