using System;
using System.Data;
using System.Configuration;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using System.Data.SqlClient;
namespace db2.API
{
public class DBLayer
{
SqlCommand ObjCmd;
SqlDataAdapter ObjDa;
DataSet ObjDs;
SqlConnection Con = SqlConnection(ConfigurationManager.AppSettings["SqlCon"]);
public int ExecuteNonQuery(string ObjStr, SqlParameter[] Parameter)
{
Con.Open();
ObjCmd = new SqlCommand();
ObjCmd.CommandType = CommandType.StoredProcedure;
ObjCmd.CommandText = ObjStr;
ObjCmd.Parameters.AddRange(Parameter);
return ObjCmd.ExecuteNonQuery();
Con.Close();
}
public int ExecuteScalar(string ObjStr, SqlParameter[] Parameter)
{
Con.Open();
ObjCmd = new SqlCommand();
ObjCmd.CommandType = CommandType.StoredProcedure;
ObjCmd.CommandText = ObjStr;
ObjCmd.Parameters.AddRange(Parameter);
return ObjCmd.ExecuteScalar();
Con.Close();
}
public DataSet ExeDataSet(string ObjStr, SqlParameter[] Parameter)
{
ObjCmd = new SqlCommand();
ObjCmd.CommandType = CommandType.StoredProcedure;
ObjCmd.CommandText = ObjStr;
ObjCmd.Connection = Con;
ObjCmd.Parameters.AddRange(Parameter);
ObjDa = new SqlDataAdapter();
ObjDa.SelectCommand = ObjCmd;
ObjDs = new DataSet();
ObjDa.Fill(ObjDs);
return ObjDs;
}
}
}
using System.Data;
using System.Configuration;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using System.Data.SqlClient;
namespace db2.API
{
public class DBLayer
{
SqlCommand ObjCmd;
SqlDataAdapter ObjDa;
DataSet ObjDs;
SqlConnection Con = SqlConnection(ConfigurationManager.AppSettings["SqlCon"]);
public int ExecuteNonQuery(string ObjStr, SqlParameter[] Parameter)
{
Con.Open();
ObjCmd = new SqlCommand();
ObjCmd.CommandType = CommandType.StoredProcedure;
ObjCmd.CommandText = ObjStr;
ObjCmd.Parameters.AddRange(Parameter);
return ObjCmd.ExecuteNonQuery();
Con.Close();
}
public int ExecuteScalar(string ObjStr, SqlParameter[] Parameter)
{
Con.Open();
ObjCmd = new SqlCommand();
ObjCmd.CommandType = CommandType.StoredProcedure;
ObjCmd.CommandText = ObjStr;
ObjCmd.Parameters.AddRange(Parameter);
return ObjCmd.ExecuteScalar();
Con.Close();
}
public DataSet ExeDataSet(string ObjStr, SqlParameter[] Parameter)
{
ObjCmd = new SqlCommand();
ObjCmd.CommandType = CommandType.StoredProcedure;
ObjCmd.CommandText = ObjStr;
ObjCmd.Connection = Con;
ObjCmd.Parameters.AddRange(Parameter);
ObjDa = new SqlDataAdapter();
ObjDa.SelectCommand = ObjCmd;
ObjDs = new DataSet();
ObjDa.Fill(ObjDs);
return ObjDs;
}
}
}
Comments
Post a Comment