execute simple SP

G

Guest

Hello all!

I have a store proceudre that when it runs, it turns a 0 into a 1. Just one
row, one value. I'm kinda of using it a check point. So the procedure
returns no value at all. I want to just have a button click execute my
procedure. Do I still use non-query, or how would I write that to execute
it. I know I need the connection and stuff, just not sure how to execute it.
Thanks!

Rudy
 
M

mohanaryal

Hi,

use command object to execute SP. on the ExecuteNonQuery() method which
will return integer value that how many rows are affected. otherwise
you can set commandText property as 'exec spName'. and execute it by
ExecuteScalar() method which will return first field of first row. that
is single value which u want.

others alternatives also are there, like you can assign it to dataset
during execution.. etc.

I think you are satisfy with this answer.
Mohan
(e-mail address removed)
 
G

Guest

Thank you ohanaryal! Worked perfect!

Hi,

use command object to execute SP. on the ExecuteNonQuery() method which
will return integer value that how many rows are affected. otherwise
you can set commandText property as 'exec spName'. and execute it by
ExecuteScalar() method which will return first field of first row. that
is single value which u want.

others alternatives also are there, like you can assign it to dataset
during execution.. etc.

I think you are satisfy with this answer.
Mohan
(e-mail address removed)
 

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

Members online

Forum statistics

Threads
473,786
Messages
2,569,625
Members
45,320
Latest member
icelord

Latest Threads

Top