sqlhelper - Sql helper class in asp.net -
why should use sql helper class in our application.what difference between sql helper class , simple class.in situation sql helper should used.please define structure of class.
sqlhelper
intended consolidate mundane, repetitive code written time , time again in data access layer components of ado.net applications, this:
using microsoft.applicationblocks.data; sqlhelper.executenonquery(connection,"insert_person", new sqlparameter("@name",txtname.text), new sqlparameter("@age",txtage.text));
instead of this:
string connectionstring = (string) configurationsettings.appsettings["connectionstring"]; sqlconnection connection = new sqlconnection(connectionstring); sqlcommand command = new sqlcommand("insert_person",connection); command.commandtype = commandtype.storedprocedure; command.parameters.add(new sqlparameter("@name",sqldbtype.nvarchar,50)); command.parameters["@name"].value = txtname.text; command.parameters.add(new sqlparameter("@age",sqldbtype.nvarchar,10)); command.parameters["@age"].value = txtage.text; connection.open(); command.executenonquery(); connection.close();
it part of microsoft application blocks framework.
Comments
Post a Comment