sqlhelper is a completely open source source code component. Using sqlhelper can easily operate sqlserver, oracle, access and other databases. Simple syntax and improved performance.
Two ways to write SqlHelper:
SqlHelper make in Visual studio 2010.support sqlserver,access,oracle databases.
Multi-statement or transaction mode:
using (SqlConnection conn = SqlServerHelper.GetConnection())
{
conn.Open();
SqlServerHelper.ExecuteNonQuery(conn,CommandType.Text,"insert into [students] values(@student_name,@class)",
SqlServerHelper.CreateInputParameter("@student_name", SqlDbType.NVarChar, 100, txt_student_name_sqlserver.Text),
SqlServerHelper.CreateInputParameter("@class", SqlDbType.NVarChar, 100, txt_class_sqlserver.Text)
);
g1.DataSource = SqlServerHelper.ReadTable(conn, CommandType.Text, "select * from [students]", null);
g1.DataBind();
}
Easy way:
SqlServerHelper.ExecuteNonQuery(CommandType.Text,"insert into [students] values(@student_name,@class)",
SqlServerHelper.CreateInputParameter("@student_name", SqlDbType.NVarChar, 100, txt_student_name_sqlserver.Text),
SqlServerHelper.CreateInputParameter("@class", SqlDbType.NVarChar, 100, txt_class_sqlserver.Text)
);