Execute nonquery returns no. of afected rows.So if my stored
procedure hav lot of select stmnt, delete stmnt, insert
stmnt..then what does execute nonquery returns in this case?
Answers were Sorted based on User's Feedback
Answer / sandyni
Execute nonquery effects only for DML like Update delete
and insert statements only,
for select statement we have to choose ExecuteScalar or
ExecuteReader methods. these methods can return datareader
and gives the result for your query.
| Is This Answer Correct ? | 18 Yes | 6 No |
Answer / suresh reddy
returns -1, since you can't find the how many rows effected because of your stored procedure.
| Is This Answer Correct ? | 4 Yes | 0 No |
Answer / suraj
I don'nt have the right ans but i think the question was if
i have lot of delete stmnt, insert stmnt and update
statement...then what does execute nonquery returns in this
case? as for select we use execute reader...
| Is This Answer Correct ? | 0 Yes | 0 No |
Answer / jaya tiwari
Execute non query executes a query that is associated with
sqlCommand object . sqlCommand object having a property
sqlCommandobj.CommandText in which we pass the query. so
ExecuteNonQuery will return the no of rows affected by that
command whose sqlCommand obj invokes this method .
and it can't be use for select as its return type is int
that is no of rows affected in execution of that query
| Is This Answer Correct ? | 1 Yes | 1 No |
Answer / sireesha
ExecuteNonQuery() returns one one value. the return type of
ExecuteNonQuery is integer. It returns the value that are
effected by the executeNonQuery() statement.
| Is This Answer Correct ? | 1 Yes | 1 No |
When we are running the Application, if any errors occur in the Stored Procedure then how will the server identify the errors?
The answers which posted above is not satisfied my requirement? Can some one post teh exact answer? Thanx
What is DataRowCollection?
What is the difference between SqlCommand and SqlCommandBuilder?
What is ado circle?
What is the difference between data grid and data repeater?
How to get oledb connection?
How to perform sorting on a table in ADO.NET?
0 Answers Petranics Solutions,
Explain the ADO . Net Architecture ( .Net Data Provider) ?
what is data Adapter?
26 Answers CMC, CSS, IBM,
What are the different ado.net namespaces?
If we are not returning any records from the database, which method is to be used?
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)