SqlHelper class is a utility class that can be used to execute commands in a SQL Server database.
Introduction
The SqlHelper class is a utility class that can be used to execute commands in a SQL Server database. We know ADO.Net methods like SqlConnection,SqlDatAdapter and SqlCommand. To use these methods users typically write repititive lines of code like connecting to a db, executing the queries and finally disconnection from the db, etc. SqlHelper Class helps to reduce the number of lines coded.
Namespace
Microsoft.ApplicationBlocks.Data
Methods
ExecuteDataSet
ExecuteNonQuery
ExecuteReader
ExecuteScalar
ExecuteXmlReader
Syntax
SqlHelper.ExecuteDataSet(SqlConnection connection,string spname,params object[] parameter)
Example
SqlHelper.ExecuteNonQuery(DataAccess.ConnectionString, CommandType.StoredProcedure, "InsertStudent", new SqlParameter ("@RollNo",rollNo), new SqlParameter("@Name",name),new SqlParameter ("@Class",class));
References
http://msdn.microsoft.com/en-us/library/cc467894.aspx
http://www.codeproject.com/Tips/555870/SQL-Helper-Class-Microsoft-NET-Utility