get the app get the app       get the app       get the app
What is the use of Command objects?


  • : 321
  • : 16
    Previous Next

    They are used to connect a Connection object to a DataReader or DataSet. Following are the methods provided by a Command object:

  • ExecuteNonQuery
    Executes the command defined in the CommandText property against the connection defined in the Connection property for a query that does not return any row (an UPDATE, DELETE, or INSERT). Returns an Integer indicating the number of rows affected by the query.

  • ExecuteReader
    Executes the command defined in the CommandText property against the connection defined in the Connection property. Returns a "reader" object that is connected to the resulting row set within the database, allowing the rows to be retrieved.

  • ExecuteScalar
    Executes the command defined in the CommandText property against the connection defined in the Connection property. Returns only a single value (effectively the first column of the first row of the resulting row set, any other returned columns and rows are discarded). It is fast and efficient when only a "singleton" value is required.

  • you can suggest other answer in comment box


  • Exam: ADO .NET Interview Questions





    Recommended Learning for you

    Close(X)
    Subscribe here for free mock test on IAS PCS SSC and other competitive exam. Signup here to get SSC CGL Solution and main exam study material