sqlcommand question

  • Thread starter Thread starter 00eric claption
  • Start date Start date
0

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.
 
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
 
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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top