Sunday, February 19, 2012

Best way to send DB results to variable

Hello all

I have a database query which will return a single value

SELECT COUNT(DISTINCT(Level_id)) FROM RoleSkill WHERE Route_ID = 1

obviously this will return only a single value and not an array of data like most database queries, therefore i would like it to be sent directly to an integer variable.

I tried doing this directly with a sqlcommand but get error that it cannot be converted to integer. Is there a good way of solving this problem?

thanks for your help

TomExecuteScalar|||Aha right you are!

thanks very much i expected the process to be more complex, i had forgotten there are 3 options for a command object.

cheers ...Tom|||Output parameters

No comments:

Post a Comment