Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...


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



Execute nonquery returns no. of afected rows.So if my stored procedure hav lot of select stmnt, de..

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

Execute nonquery returns no. of afected rows.So if my stored procedure hav lot of select stmnt, de..

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

Execute nonquery returns no. of afected rows.So if my stored procedure hav lot of select stmnt, de..

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

Execute nonquery returns no. of afected rows.So if my stored procedure hav lot of select stmnt, de..

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

Execute nonquery returns no. of afected rows.So if my stored procedure hav lot of select stmnt, de..

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

Execute nonquery returns no. of afected rows.So if my stored procedure hav lot of select stmnt, de..

Answer / pankaj shinde

Total number of rows effected.

Is This Answer Correct ?    0 Yes 1 No

Post New Answer

More ADO.NET Interview Questions

How to get oledb connection?

3 Answers  


Which provider is used to connect ms access, oracle, etc…?

0 Answers  


What is csdl entity framework?

0 Answers  


What is the difference between ado.net and oledb?

0 Answers  


What is the use of ADO.NET and XML web services?

0 Answers   TCS,


How to identify the controls which can be used for binding data?

0 Answers  


How To Update A Column In A DataGrid Using C#.NET? I am getting InvalidCastException as (Specified cast is not valid) while updating 2nd column in a datagrid? Id,firstname,lastname are the three columns of my datagrid respectively. I wanted to edit the second column(lastname) and update it. I did the following code in DataGrid's updatecommand(),but failed to update ! Int varid=(int)DataGrid1.DataKeys[e.Item.ItemIndex]; TextBox lnm=(TextBox)e.Item.Cells[2].Controls[0]; string str=lnm.Text ; SqlCommand cmd=new SqlCommand("update customer set lastname='" + str + "' where id=" + varid + "",con); cmd.ExecuteNonQuery(); DataGrid1.EditItemIndex=- 1; DataGrid1.DataBind();

2 Answers   Mind Tree, TCS,


What are the three Objects of ADO.

10 Answers  


What is ado.net in mvc?

0 Answers  


Differnce between Stored procedure and user defined functions?

17 Answers   Microsoft, Symphony,


What is ole db and odbc?

0 Answers  


What is the difference between DataReader and DataSet in ADO.NET?

0 Answers   Petranics Solutions,


Categories