SqlCommand

mandelbrot

Well-known member
Joined
Jul 1, 2005
Messages
190
Location
UK North East
Hi Everyone,


Just a quick question here -

Is there any real advantage in using the SqlCommand object (or any Command object, for that matter)?


TIA,
Paul.
 
Last edited by a moderator:
mandelbrot said:
Hi Everyone,


Just a quick question here -

Is there any real advantage in using the SqlCommand object (or any Command object, for that matter)?


TIA,
Paul.
Well if you want to get data out of a database using managed code, its the only way I know of. . .
 
Not without a command object you cant - a DataAdapter can take care of the creation of the command for you but there is still a command object being created.
 
...and expanding on this...

Sorry, guys - I didnt receive an e-mail for this thread *(Ive set the option in my control panel, now - missed it before!)*, and havent managed to get back for quite a while.

Yep - I was actually using a DataSet object and noticed that you can enter the SQL command directly as a string. I didnt realise that doing this actually makes the DataSet generate an SQL Command object.

Just to extend this question further, then:

Is there any advantage, also, to using parameters? After all, the query string could be built up using appended strings then submitted as a Command directly, instead of having to use parameter objects...


(Please note that these are more questions, I suppose, of "what is good and bad practice within OOP and VS.NET?").


Thanks again, to you all.


Paul.
 
Last edited by a moderator:
Back
Top