Click here to Skip to main content
15,896,557 members
Home / Discussions / Database
   

Database

 
AnswerRe: Iterating trough database tables (SQL) Pin
Steve S12-Jul-06 3:03
Steve S12-Jul-06 3:03 
AnswerRe: Iterating trough database tables (SQL) Pin
Scott Serl12-Jul-06 6:29
Scott Serl12-Jul-06 6:29 
GeneralRe: Iterating trough database tables (SQL) Pin
johan313113-Jul-06 0:35
johan313113-Jul-06 0:35 
QuestionINSERT INTO and SELECT statement... pls help urgently.. Pin
For_IT12-Jul-06 0:19
For_IT12-Jul-06 0:19 
AnswerRe: INSERT INTO and SELECT statement... pls help urgently.. Pin
VK-Cadec12-Jul-06 9:53
VK-Cadec12-Jul-06 9:53 
QuestionData Access Application Block Pin
Brendan Vogt11-Jul-06 21:22
Brendan Vogt11-Jul-06 21:22 
AnswerRe: Data Access Application Block Pin
kumarprabhakar7412-Jul-06 0:25
kumarprabhakar7412-Jul-06 0:25 
QuestionThe using block Pin
Brendan Vogt11-Jul-06 21:12
Brendan Vogt11-Jul-06 21:12 
I have the following using block (not all code is displayed):

try
{
using (dbCommand = db.GetStoredProcCommand("sp_GetAllCars"))
{
rdr = db.ExecuteReader(dbCommand);

while (rdr.Read())
{
Car objCar = new Car();
objCar.ID = rdr.GetInt32(0); // Required
objCar.Name = rdr.GetString(1); // Required

// Add Car instance to array
carList.Add(objCar);
}
// Close the reader object
rdr.Close();
}
}
catch (SqlException ex)
{
HandleSQLError(ex, "sp_GetAllCars");
}
finally
{
dbCommand.Dispose();
}

What does the using block close and dispose of, because I am thinking that I am closing uneccessary stuff. I always thought that the using block only closed this that were declared in the brackets like:

using (...only closed what inserted here...)
{
...
}

Please can someone comment.

Regards,
ma se
AnswerRe: The using block Pin
ekhorutomwen11-Jul-06 22:49
ekhorutomwen11-Jul-06 22:49 
QuestionRe: The using block Pin
Brendan Vogt11-Jul-06 23:08
Brendan Vogt11-Jul-06 23:08 
AnswerRe: The using block [modified] Pin
ekhorutomwen11-Jul-06 23:30
ekhorutomwen11-Jul-06 23:30 
GeneralRe: The using block Pin
Brendan Vogt11-Jul-06 23:47
Brendan Vogt11-Jul-06 23:47 
AnswerRe: The using block Pin
Kevin McFarlane12-Jul-06 0:22
Kevin McFarlane12-Jul-06 0:22 
QuestionChecking for an Existing record when Updating Pin
Brendan Vogt11-Jul-06 21:08
Brendan Vogt11-Jul-06 21:08 
AnswerRe: Checking for an Existing record when Updating Pin
kumarprabhakar7412-Jul-06 0:21
kumarprabhakar7412-Jul-06 0:21 
QuestionUpdate statement Pin
angelagke11-Jul-06 18:23
angelagke11-Jul-06 18:23 
AnswerRe: Update statement Pin
Dinuj Nath11-Jul-06 20:51
Dinuj Nath11-Jul-06 20:51 
GeneralRe: Update statement Pin
angelagke11-Jul-06 21:37
angelagke11-Jul-06 21:37 
GeneralRe: Update statement Pin
VK-Cadec12-Jul-06 10:01
VK-Cadec12-Jul-06 10:01 
GeneralRe: Update statement Pin
angelagke13-Jul-06 2:07
angelagke13-Jul-06 2:07 
QuestionConnectionString works for VB6/VBNET/VBNET2003 for SQL SERVER but not for VBNET2005 SQL SERVER only local Pin
Serpiente11-Jul-06 15:16
Serpiente11-Jul-06 15:16 
QuestionOutput parameter in stored procedure Pin
leckey11-Jul-06 9:27
leckey11-Jul-06 9:27 
AnswerRe: Output parameter in stored procedure Pin
nguyenvhn11-Jul-06 22:38
nguyenvhn11-Jul-06 22:38 
GeneralRe: Output parameter in stored procedure Pin
leckey12-Jul-06 3:13
leckey12-Jul-06 3:13 
QuestionDB Connection Failure using C# Pin
Cadence2.011-Jul-06 9:03
Cadence2.011-Jul-06 9:03 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.