What is the use of Command objects? Command object helps to execute SQL statements. Following are the methods provided by command object:- ExecuteNonQuery: – Executes insert, update and delete SQL commands. Returns an Integer indicating the number of rows affected by the query. ExecuteReader: – Executes select SQL statements which can either be in your .NET code or in a stored procedure. Returns a "Datareader" object. ExecuteScalar: – Executes SQL command and returns only a single value like count,sum , first record etc. How can we fine-tune the command object when we are expecting a single row? Again, CommandBehaviour enumeration provides two values Single Result and Single Row. If you are expecting a single value then pass "CommandBehaviour.SingleResult" and the query is optimized accordingly, if you are expecting single row then pass "CommandBehaviour.SingleRow" and query is optimized according to single row. What are Dataset objects? Dataset is an in memory object with data tables, rows and columns.


I guess you came to this post by searching similar kind of issues in any of the search engine and hope that this resolved your problem. If you find this tips useful, just drop a line below and share the link to others and who knows they might find it useful too.

Stay tuned to my blogtwitter or facebook to read more articles, tutorials, news, tips & tricks on various technology fields. Also Subscribe to our Newsletter with your Email ID to keep you updated on latest posts. We will send newsletter to your registered email address. We will not share your email address to anybody as we respect privacy.


This article is related to

Uncategorized,(Information technology) IT interview questions with answers,Ado.Net Interview Questions,ADO.NET step by step training,ADO.NET training,command object,connection object,Csharp interview questions,dataset object,programming interview questions