November 30, 2001 at 12:00 am
Comments posted to this topic are about the content posted at http://www.sqlservercentral.com/columnists/jwiner/anintroductiontousingtheadonetsqlcommandobject.asp
April 26, 2002 at 3:47 pm
You might want to add that the syntax:
cmdMyCommand.Parameters("@LastName") = strLastName
that works just fine under ADO
doesn't seem to work under ADO.Net.
Sprocs don't seem to know anything about their parameters until execution. I guess it makes sense when one considers the basic idea behind ADO.Net is to do away with stateful database interactions.
This change was the cause of some consternation here, as disappearance of the the old syntax does not seem to be documented anywhere.
Brian Begy
Chicago Data Solutions
Brian Begy
Chicago Data Solutions
August 6, 2004 at 10:13 am
I know this is just an example that you presented in the article. So I have a recommedation ( learnt over time).
When you are working with connections to the database using the command object, I would sincerely recommend the following technique . The following practice will keep the connection pool in better control:
Instead of myCommand.Open(); or myCommand.Close(); directly
Use this while opening connections:
if( myCommand.Connection.State == ConnectionState.Closed)
myCommand.Open();
Use this while closing connections:
if( myCommand.Connection.State == ConnectionState.Open)
myCommand.Close();
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply