excute scalar
what is the use of excute scalar?
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Munesh SharmaPosted Nov 11, 2014, 7:18 AM
Joginder BangerPosted Nov 11, 2014, 6:55 AM
sqlcommand com= new SqlCommand("select name from tableName where id=15","connection string")
object temp=com.ExecuteScalar();
you get a name of the respective id number 15.
i know it's not enough but so following this link
http://csharp.net-informations.com/data-providers/csharp-sqlcommand-executescalar.htm
Try on Google thousand of link available about the scalar.
Guest UserPosted Nov 11, 2014, 6:01 AM
It returns the first column of the first row in the result set. If you execute a query to get one specific result (a count for example) you can use this method to get directly at the value.