Excute scalar
what is the use of excute scalar?
3 Answers
Know the answer? Post it. Somebody with the same question will find it here.
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Guest UserRank #816 · 2.8K reputationPosted Nov 11, 2014, 1:01 AM EST
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.
Joginder BangerRank #360 · 7K reputationPosted Nov 11, 2014, 1:55 AM EST
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.
Munesh SharmaRank #174 · 13.9K reputationPosted Nov 11, 2014, 2:18 AM EST