
Untitled
By: a guest on
May 10th, 2012 | syntax:
None | size: 0.94 KB | hits: 16 | expires: Never
using System.Configuration;
using System.Data;
using System.Data.SqlClient;
namespace Data.DataAccessLayer.DatabaseOperation
{
public class CustomersDataBaseOperation
{
public static SqlConnection ConnStr
{
get { return new SqlConnection(ConfigurationManager.ConnectionStrings["CustomerConnString"].ConnectionString); }
}
public int Insert (Storedprocedure storedprocedure, int id, string name, string mail)
{
using (ConnStr)
{
SqlCommand command= new SqlCommand(storedprocedure.ToString(),ConnStr);
command.CommandType = CommandType.StoredProcedure;
command.Parameters.AddWithValue("@ID", id);
command.Parameters.AddWithValue("@Name",name);
command.Parameters.AddWithValue("@Mail", mail);
command.Connection.Open();
command.ExecuteNonQuery();