Interviews11 answers
What method is used by the Command classes to execute SQL statements that return single values?
11 Answers
ExecuteScalar
Sunil BabuPosted Apr 3, 2016, 4:11 AM EDT
ExecuteScalar();
Sujeet SumanPosted Jul 2, 2015, 2:41 AM EDT
ExecuteScalar returns the first column of the first row in the result set returned by the query.
Sujeet SumanPosted Jul 2, 2015, 2:41 AM EDT
cmd.ExecuteScalar();
Sreekanth ReddyPosted Jun 17, 2015, 5:51 AM EDT
sqlcommand.executescalar()
Rahul PrajapatPosted May 26, 2015, 5:42 PM EDT
ExecuteScalar()
Lalit RaghavPosted May 13, 2015, 12:30 AM EDT
ExecuteScaler() Method will be used for Single value.
sajidlkhan lodiPosted Feb 9, 2015, 2:25 AM EST
The ExecuteScalat method of the command object returns single values from the sql query. It return the first column of the first row of the query.
plmPosted Sep 19, 2013, 6:31 AM EDT
SqlCommand.ExecuteScalar();
Pramod LawatePosted Aug 26, 2013, 9:04 AM EDT
Execute Scalar.
var requruedResult=SqlCommand.ExecuteScalar();
It will return first row's first column value.
Sandeep GhoshPosted Aug 14, 2013, 11:02 PM EDT
SqlCommand.ExecuteScalar();
This return only a single value(that is the first column of the first row. Other values are ignored)
Link:
http://msdn.microsoft.com/en-us/library/system.data.sqlclient.sqlcommand.aspx
Also see this thread:
http://www.c-sharpcorner.com/Interviews/answer/6397/define-execute-scalar
Srikaran N SarmaPosted Jul 14, 2013, 8:18 PM EDT




