C# Corner
Tech
News
Videos
Forums
Jobs
Books
Events
More
Interviews
Live
Learn
Training
Career
Members
Blogs
Challenges
Certification
Contribute
Article
Blog
Video
Ebook
Interview Question
Collapse
Feed
Dashboard
Wallet
Learn
Achievements
Network
Refer
Rewards
SharpGPT
Premium
Contribute
Article
Blog
Video
Ebook
Interview Question
Register
Login
.NET
ADO.NET
Android
ASP.NET
C#
Databases & DBA
Design Patterns & Practices
iOS
Java
OOP/OOD
SharePoint
Software Testing
Web Development
WPF
View All
47
Reply
Define Execute Scalar?
Mohan Gupta
12y
8.2k
1
Reply
Delete Row
Delete Column
Insert Link
×
Insert
Cancel
Embed YouTube Video
×
Width (%)
Height (%)
Insert
Cancel
Table Options
×
Rows
Columns
First row as header
Create Table
Insert Image
×
Selected file:
Alignment
Left
Center
Right
Select an image from your device to upload
Upload to Server
Cancel
Submit
ExecuteScalar() in SqlCommand Object is used for get a single value from Database after its execution. It executes SQL statements or Stored Procedure and returned a scalar value on first column of first row in the Result Set. If the Result Set contains more than one columns or rows , it takes only the first column of first row, all other values will ignore. If the Result Set is empty it will return a Null reference.It is very useful to use with aggregate functions like Count(*) or Sum() etc. When compare to ExecuteReader() , ExecuteScalar() uses fewer System resources.
Satish Verma
12y
2
It execute Query and return Single value
sajidlkhan lodi
10y
1
Execute scalar is return only one column and one row from database and this is the one of the ADO.Net Command
Bhabani Prasad
11y
1
ExecuteScalar is typically used when your query returns a single value. If it returns more, then the result is the first column of the first row. An example might be SELECT @@IDENTITY AS 'Identity'.
Bharathi Raja
7y
0
The query which returns single result
Manoj Kumar
8y
0
For fetching a single cell(which rresults from a sql command) value.
Srikanth Reddy
10y
0
ExecuteScalar is typically used when your query returns a single value. If it returns more, then the result is the first column of the first row. An example might be SELECT @@IDENTITY AS 'Identity'.
bharat aggarwal
10y
0
ExecuteScalar is typically used when your query returns a single value. If it returns more, then the result is the first column of the first row. An example might be SELECT @@IDENTITY AS 'Identity'.
bharat aggarwal
10y
0
ExecuteScalar is typically used when your query returns a single value. If it returns more, then the result is the first column of the first row. An example might be SELECT @@IDENTITY AS 'Identity'.
bharat aggarwal
10y
0
ExecuteScalar is typically used when your query returns a single value. If it returns more, then the result is the first column of the first row. An example might be SELECT @@IDENTITY AS 'Identity'.
bharat aggarwal
10y
0
ExecuteScalar is typically used when your query returns a single value. If it returns more, then the result is the first column of the first row. An example might be SELECT @@IDENTITY AS 'Identity'.
bharat aggarwal
10y
0
ExecuteScalar is typically used when your query returns a single value. If it returns more, then the result is the first column of the first row. An example might be SELECT @@IDENTITY AS 'Identity'.
bharat aggarwal
10y
0
ExecuteScalar is typically used when your query returns a single value. If it returns more, then the result is the first column of the first row. An example might be SELECT @@IDENTITY AS 'Identity'.
bharat aggarwal
10y
0
ExecuteScalar is typically used when your query returns a single value. If it returns more, then the result is the first column of the first row. An example might be SELECT @@IDENTITY AS 'Identity'.
bharat aggarwal
10y
0
ExecuteScalar is typically used when your query returns a single value. If it returns more, then the result is the first column of the first row. An example might be SELECT @@IDENTITY AS 'Identity'.
bharat aggarwal
10y
0
ExecuteScalar is typically used when your query returns a single value. If it returns more, then the result is the first column of the first row. An example might be SELECT @@IDENTITY AS 'Identity'.
bharat aggarwal
10y
0
ExecuteScalar is typically used when your query returns a single value. If it returns more, then the result is the first column of the first row. An example might be SELECT @@IDENTITY AS 'Identity'.
bharat aggarwal
10y
0
ExecuteScalar is typically used when your query returns a single value. If it returns more, then the result is the first column of the first row. An example might be SELECT @@IDENTITY AS 'Identity'.
bharat aggarwal
10y
0
ExecuteScalar() It is a predefined member method of Command class. Used to execute and return single record at a time from the database. the return of the ExecuteScalar() method is object
Srinivas Pabballa
10y
0
Its always return one value from database after its execution
Yatendra Sharma
10y
0
ExecuteScalar returns the first column of the first row in the result set returned by the query. Additional columns or rows are ignored.
Sujeet Suman
10y
0
returns Single cell as output. Ex: select max sal from empsingle cell. o/p: 34000
Srikanth Reddy
10y
0
It return first column of first row value
Rahul Prajapat
10y
0
it return first element of first column of first row of table as a object.......
Pankaj Kumar Choudhary
10y
0
ExecuteScalar is return a single value,the return values type is integer format.when we want table record count only use this executescalar.
CHANDRAN KANDAN
10y
0
It is a command object which is used in DML command and it return single value.
Munesh Sharma
11y
0
It is a method of command object. It will return only one value, i.e [object] type.
subrat padhy
12y
0
Running MS-SQL Server - Execute Scalar
Vivek Gupta
12y
0
Execute scalar is return only one column and one row from database and this is the one of the ADO.Net Command
Pramod Lawate
12y
0
It is one of the way to execute select command in sqlserver through code behind. It will return first row's first column as a result. Basically use this sqlcommand when we use aggregate function in Sql Query.
Sandeep Ghosh
12y
0
Execute Scalar is using to retrieve a data from database
Bineesh VP
12y
0
It is used to perform the query which returns singal record like Sum(),Max(),Avrg().It return type will be Object so we need to cast them.
Abhineet Srivastava
12y
0
It is used to perform the query which returns singal record like Sum(),Max(),Avrg().It return type will be Object so we need to cast them.
Abhineet Srivastava
12y
0
It is used to perform the query which returns singal record like Sum(),Max(),Avrg().It return type will be Object so we need to cast them.
Abhineet Srivastava
12y
0
It is used to perform the query which returns singal record like Sum(),Max(),Avrg().It return type will be Object so we need to cast them.
Abhineet Srivastava
12y
0
It is used to perform the query which returns singal record like Sum(),Max(),Avrg().It return type will be Object so we need to cast them.
Abhineet Srivastava
12y
0
It is used to perform the query which returns singal record like Sum(),Max(),Avrg().It return type will be Object so we need to cast them.
Abhineet Srivastava
12y
0
It is used to perform the query which returns singal record like Sum(),Max(),Avrg().It return type will be Object so we need to cast them.
Abhineet Srivastava
12y
0
It is used to perform the query which returns singal record like Sum(),Max(),Avrg().It return type will be Object so we need to cast them.
Abhineet Srivastava
12y
0
ExecuteScalar is a method of SQLCommand that Executes the query, and returns the first column of the first row of the result set returned by the query. Returns only the first column of the first row. SELECT count(*) FROM table_name;
Srikaran N Sarma
12y
0
Execute Scalar is an ADO.NET object which is used to get single value from Back End using Aggregate Functions
nethaji naidu
12y
0
If we want to fetch only one value from the back end then we can go for Execute Scalar
Srikanth Reddy
12y
0
If we want to fetch only one value from the back end then we can go for Execute Scalar
Srikanth Reddy
12y
0
In Ado.Net Command Execute Scalar always return a Single Object and you have to cast or convert value from this Object you cant directly use it.
Kunal Vaishya
12y
0
It is one of the command object in ADO.NET. It will return only a single value. That is 1st column of the 1st row value. Ex: All Aggregate functions.
lavanya veerasamy
12y
0
Bharat Gunjal
12y
0
Execute Scalar will work with Non-Action Queries(select) that contain aggregate functions.
Dhiraj Sharma
12y
0
What are managed providers?
How do I delete a row from a DataTable?
Message