Data Access Layer-- PART-3

BangaruBabu
Posted by BangaruBabu under ASP.NET category on | Views : 3610
public static SqlDataReader ExecuteSPDataReader(string strSPName, params
SqlParameter[] objParams)
{
SqlDataReader reader;
try
{
reader = SqlHelper.ExecuteReader(getConnection(),
CommandType.StoredProcedure, strSPName, objParams);
}
catch (SqlException exception)
{
throw exception;
}
catch (Exception exception2)
{
throw exception2;
}
return reader;
}


-----------------

public static DataSet ExecuteSPDataset(string strSPName, params
SqlParameter[] objParams)
{
DataSet set;
try
{
set = SqlHelper.ExecuteDataset(getConnection(),
CommandType.StoredProcedure, strSPName, objParams);
}
catch (SqlException exception)
{
throw exception;
}
catch (Exception exception2)
{
throw exception2;
}
return set;
}
-----------
public static int ExecuteSPNonQuery(string strSPName, params SqlParameter[] objparams)
{
int num;
try
{
num = SqlHelper.ExecuteNonQuery(getConnection(),
CommandType.StoredProcedure, strSPName, objparams);
}
catch (SqlException exception)
{
throw exception;
}
catch (Exception exception2)
{
throw exception2;
}
return num;
}

----------
public static int ExecuteSPNonQuery(SqlTransaction transaction, string
strSPName, params SqlParameter[] objparams)
{
int num;
try
{
num = SqlHelper.ExecuteNonQuery(transaction,
CommandType.StoredProcedure, strSPName, objparams);
}
catch (SqlException exception)
{
throw exception;
}
catch (Exception exception2)
{
throw exception2;
}
return num;
}
--------------

public static object ExecuteSPScalar(string strSPName, params SqlParameter[]
objparams)
{
object obj2;
try
{
obj2 = SqlHelper.ExecuteScalar(getConnection(), strSPName,
objparams);
}
catch (SqlException exception)
{
throw exception;
}
catch (Exception exception2)
{
throw exception2;
}
return obj2;
}

------------------
public static SqlParameter[] GetCachedParameterSet(string commandText)
{
return SqlHelperParameterCache.GetCachedParameterSet(getConnection(),
commandText);
}

-------------
public static string getConnection()
{
return ConfigurationSettings.AppSettings["strCon"];
}

-----------
public static SqlParameter[] GetSpParameterSet(string strSPName)
{
return SqlHelperParameterCache.GetSpParameterSet(getConnection(),
strSPName);
}

------------
public static SqlParameter[] GetSpParameterSet(string strSPName, bool
includeReturnValueParameter)
{
return SqlHelperParameterCache.GetSpParameterSet(getConnection(),
strSPName, includeReturnValueParameter);
}

Comments or Responses

Login to post response