Aspdotnet-Suresh

aspdotnet-suresh offers C#.net articles and tutorials,csharp dot net,asp.net articles and tutorials,VB.NET Articles,Gridview articles,code examples of asp.net 2.0 /3.5,AJAX,SQL Server Articles,examples of .net technologies

Differences between ExecuteReader, ExecuteNonQuery AND ExecuteScalar

Sep 19, 2012
Introduction:

In this article I will explain differences between executereader, executenonquery and executescalar in asp.net.

Description:

In previous posts I explained difference between Len and DataLength functions, difference between int,tinyint and bigint and differences between char, varchar and nvarchar in SQL Server. Now I will explain difference between executereader, executenonquery and executescalar in asp.net

ExecuteNonQuery

ExecuteNonQuery method will return number of rows effected with INSERT, DELETE or UPDATE operations. This ExecuteNonQuery method will be used only for insert, update and delete, Create, and SET statements. (Read More)

ExecuteScalar

Execute Scalar will return single row single column value i.e. single value, on execution of SQL Query or Stored procedure using command object. It’s very fast to retrieve single values from database. (Read More)

ExecuteReader

Execute Reader will be used to return the set of rows, on execution of SQL Query or Stored procedure using command object. This one is forward only retrieval of records and it is used to read the table values from first to last. (Read More)

If you enjoyed this post, please support the blog below. It's FREE!

Get the latest Asp.net, C#.net, VB.NET, jQuery, Plugins & Code Snippets for FREE by subscribing to our Facebook, Twitter, RSS feed, or by email.

subscribe by rss Subscribe by RSS subscribe by email Subscribe by Email

21 comments :

anvesh nani said...

its very useful.....

Ganapathi said...

thanks

Anonymous said...

thankssssss

sriraj said...
This comment has been removed by the author.
Anonymous said...

its very useful

Ravi chanti said...

Sir this is Ravi can you please help me for this
how to find SMTP SERVER IP FOR MY SITE.USING MY SYSTEM.
EXE YOUR sSmtpServer = "10.2.69.121" .
SEND TO MY MAIL ID:ravidotnetsite@gmail.com

Suresh Dasari said...

@Ravi Chanti...
SMTP server means it's mail exchange server it will configure by network people.It's not possible to find the IP of smtpserver with your site or your system. If you host the site in any service provide ask them to provide smtp server address to send mails.

Kashyap Manani said...

with very simple understanding....thanks bro.

hermes said...

Great and useful information.

venky said...

provide how to write the code for preview using stored procedure

Dhananjay Birari said...

thanx

Bheema Yoganand said...

its useful friend thank you , can u provide with an example coding of the Three Methods (Execute Scalar,Execute NonQuery and Execute Reader).

birkin said...

I understand the executenonquery, really useful info.

hema said...

very useful. thank you

Anonymous said...

very simple and understandable lag. good job

Unknown said...

superb

lavanyan nalluri said...

excellent

Anonymous said...

You should have developed your page using asp...

Abhi said...

simple and best explanation

Prakash Vidwans said...

Thanks !!
This info is most useful !

MAITRI said...

thanks.. nice explaiation

Give your Valuable Comments

Other Related Posts

© 2010-2012 Aspdotnet-Suresh.com. All Rights Reserved.
The content is copyrighted to Suresh Dasari and may not be reproduced on other websites without permission from the owner.