.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month

Home >> Articles >> .Net Framework >> Post New Resource Bookmark and Share   

 Subscribe to Articles


Posted By:Shashi Ray       Posted Date: October 01, 2008    Points: 10    Category: .Net Framework    URL: http://www.dotnetspark.com  



ADO.NET commands are important for stored procedures and running SQL Statements. Take a look at the commands' key properties and methods.

Key properties

·         CommandText: (read/write) the T-SQL statement or stored procedure to execute at the data source.

·         CommandTimeout: (read/write) maximum time allowed for a command execution attempt.

·         CommandType: (read/write) a value indicating how the CommandText property is to be interpreted.

·         Connection: (read/write) the SqlConnection used by this instance of the SqlCommand.

·         Parameters: (read) the SqlParameterCollection.

·         Transaction: (read/write) the transaction in which the SqlCommand executes.

Key methods

·         Cancel: cancels the execution of a SqlCommand.

·         CreateParameter: creates a new instance of a SqlParameter object.

·         ExecuteNonQuery: executes a T-SQL statement against the connection and returns the number of rows affected.

·         ExecuteReader: (overloaded) sends the CommandText to the connection and builds a SqlDataReader.

·         ExecuteScalar: executes the query, and returns the first column of the first row in the resultset returned by the query.

·         ExecuteXmlReader: sends the CommandText to the connection and builds an XmlReader object.

·         Prepare: creates a prepared version of the command on an instance of SQL Server.


 Subscribe to Articles


Further Readings:


No response found. Be the first to respond this post

Post Comment

You must Sign In To post reply
Find More Articles on C#, ASP.Net, Vb.Net, SQL Server and more Here

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend