Home All Groups Group Topic Archive Search About
Author
6 Jan 2006 7:02 AM
00eric claption
In the sourcecode as following,

    Dim cmd As New SqlCommand()

    With cmd
        .CommandText = "Delete from Authors where au_lname = 'Smith'"
        .Connection = cn
        .CommandType = CommandType.Text
    End With



Please tell me what does ".CommandType = CommandType.Text "  this do.
Thanks.

Author
6 Jan 2006 8:36 AM
Cor Ligthert [MVP]
Hi,

>
> Please tell me what does ".CommandType = CommandType.Text "  this do.
> Thanks.
It can as well be the one for stored procedure

(By default is it as you have so this one is not needed)

I hope this helps,

Cor
Author
6 Jan 2006 11:46 AM
Lucky
it is used to inform the database that which kind of statment you are
firing into the DB. that helps DB to server more better.

if you are firing DML Queries on the DB than it should be "
CommandType.Text" just like you have done in your specified code.

if you are invoking any stored procedure resides in DB than you can set
the command type to "storedprocedure" that tellls the DB that u want
to run a storedProcedure and it will serve you that way.