Click here to Skip to main content
15,892,674 members
Please Sign up or sign in to vote.
1.14/5 (3 votes)
See more:
What are the different cases when we use these three? Where should I use one and where should I not? can ?
Posted

ExecuteScalar() only returns the value from the first column of the first row of your query.
ExecuteReader() returns an object that can iterate over the entire result set.
ExecuteNonQuery() does not return data at all: only the number of rows affected by an insert, update, or delete.

http://msdn.microsoft.com/en-us/library/system.data.sqlclient.sqlcommand.executenonquery%28v=vs.110%29.aspx[^]
http://msdn.microsoft.com/en-us/library/system.data.sqlclient.sqlcommand.executereader%28v=vs.110%29.aspx[^]
http://msdn.microsoft.com/en-us/library/system.data.sqlclient.sqlcommand.executescalar%28v=vs.110%29.aspx[^]
 
Share this answer
 
v2
Comments
vangapally Naveen Kumar 27-Aug-14 3:59am    
Good Links..............
Prasanth Radhakrishanan 27-Aug-14 4:11am    
thank u ...
Sergey Alexandrovich Kryukov 27-Aug-14 11:18am    
5ed.
—SA
Gihan Liyanage 27-Aug-14 23:12pm    
Thank you Sergey..
 
Share this answer
 
Comments
Prasanth Radhakrishanan 27-Aug-14 4:12am    
thanks for u r reply sir

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900