which one is faster execute reader, scalar, execute non
query ?
Answers were Sorted based on User's Feedback
Answer / satish v itagi
ExecuteNonQuery is used to inserts, updates, deletes.
ExecuteScaler is used to return values at a stretch; and
can do data modifications too.
ExecuteReader is forward only reading of row by row.
The number of readers that can be open at a time has
limitation (255)
Execute Scaler has no such restriction. You can use
sqlparameters (output) to get more than one field value,
you can use multiple queries to get more than one result.
Because of less overheads, ExecuteReader has a slight
performance advantage but has limitations.
Do not forget to close Readers!
| Is This Answer Correct ? | 4 Yes | 1 No |
Scalar will be faster that the execute reader and execute
non query. As scalar only fetch one column single row.
Whereas execute reader may return numbers of record and
though non-query will not return any records it will take
time to identify the data types to validate be4 inserting
the data
| Is This Answer Correct ? | 2 Yes | 0 No |
Answer / kamlesh sharma
most of the above answers are wrong
write answer is execute reader
| Is This Answer Correct ? | 5 Yes | 4 No |
Answer / peter
What is faster:
ExecuteNonQuery("INSERT INTO...; INSERT INTO...; INSERT
INTO");
or
ExecuteNonQuery("INSERT INTO...")
ExecuteNonQuery("INSERT INTO...")
ExecuteNonQuery("INSERT INTO...")
I hope you see my point. Of course it is not a matter of
only three inserts, but maybe 200 - and then I would like
to know if I can save time by adding the INSERT-strings to
one big string and only fire off one ExecuteNonQuery.
I was thinking of coding a test to check, but if some of
you have already done this or just know which is faster,
please let me know.
Thanks
| Is This Answer Correct ? | 1 Yes | 1 No |
what is session . how it is use ?
What is dataset ?
18 Answers Infosys, Kuwait University,
What is actually returned from server to the browser when a browser requests an .aspx file and the file is displayed?
Explain the use of view state?
In what order do the events of an ASPX page execute, As a developer is it important to understand these events?
What are server side controls?
Where is the view state data stored?
What is difference between asp state management and asp.net state management? How can we pass info between 2 asp.net pages?
In ViewState How much lifespan items stored?
Is it possible to develop a single web application using ASP.NET webforms and ASP.MVC?
What is Razor View Engine
From which base class all web forms are inherited?
Visual Basic (800)
C Sharp (3816)
ASP.NET (3180)
VB.NET (461)
COM+ (79)
ADO.NET (717)
IIS (369)
MTS (11)
Crystal Reports (81)
BizTalk (89)
Dot Net (2435)
Exchange Server (362)
SharePoint (720)
WCF (340)
MS Office Microsoft (6963)
LINQ Language-Integrated Query (317)
WPF (371)
TypeScript (144)
Microsoft Related AllOther (311)