![]() ![]() SqlCommand.ExecuteScalar MSDN Documentation It’s very fast to retrieve single values from database. Value, on execution of SQL Query or Stored procedure using command SqlCommand.ExecuteReader MSDN DocumentationĮxecute Scalar will return single row single column value i.e. Values from first to last.(Read More about ExecuteReader) This one isįorward only retrieval of records and it is used to read the table ![]() SQL Query or Stored procedure using command object. SqlCommand.ExecuteNonQuery MSDN DocumentationĮxecute Reader will be used to return the set of rows, on execution of This ExecuteNonQuery method willīe used only for insert, update and delete, Create, and SET What is the difference between ExecuteReader, ExecuteNonQuery and ExecuteScalarĮxecuteNonQuery method will return number of rows effected with ![]() You will get rows values like this drĮxecuteNonQuery : For Inserting/Deleting/Updating the rows into table ExecuteNonQuery("DELETE FROM TABLE") ĮxecuteNonQuery("UPDATE TABLE SET COLUMNNAME = 'A'") Int32 Value = Convert.ToInt32(ExecuteScalar("SELECT AVG(COLUMNNAME) FROM TABLE")) ĮxecuteReader : Row reading in forward mode IdataReader dr = ExecuteReader("SELECT * FROM TABLE") This is what documentation is made for: you have the method names go look them up.ĮxecuteScalar : For Single Value Int32 Value = Convert.ToInt32(ExecuteScalar("SELECT SUM(COLUMNNAME) FROM TABLE"))
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. Archives
December 2022
Categories |