We might know how to use ADO.Net concepts like SqlConnection,SqlDatAdapter and SqlCommand.But using this we want to write "n" no.of lines to connect with backend.To reduce these lines we are using SqlHelper Class.
Namespace for SqlHelper
SqlHelper Class comes from the namespace Microsoft.ApplicationBlocks.Data.This is a third tool party we should get from msdn and install and add the dll file to our project.
Methods in SqlHelper Class
I think u know about these methods.The syntax to use these methods
SqlHelper.ExecuteDataSet(SqlConnection connection,string spname,params object parameter)
We need a connection string,a sql query string and the values for the parameters.
SqlHelper.ExecuteNonQuery(DataAccess.ConnectionString, CommandType.StoredProcedure, "empinsert", new SqlParameter ("@EmpNo",empno), new SqlParameter("@EmpName",ename),new SqlParameter ("@EmpSal",empsal));
} catch (Exception ee)
The usage of SqlHelper Class is to reduce the no.of.lines for connecting the database through SqlClient or Oledb
Use ful article
Very useful article....
Thank you very much. It is very useful and you explained very clearly.