private DataSet Account_Statement_Schemewise(string ID, string Type, string FromDate, string ToDate)
{
System.Collections.Specialized.NameValueCollection nv = new System.Collections.Specialized.NameValueCollection();
nv.Add("@Id", ID);
nv.Add("@Type", Type);
nv.Add("@FromDate", FromDate);
nv.Add("@ToDate", ToDate);
DataLayer Obj = new DataLayer
return Obj .GetDataSet("statement", nv);
}
public DataSet GetDataSet(string Stored_Procedure, NameValueCollection nv)
{
DataSet ds = new DataSet();
SqlConnection cn = new SqlConnection(objDBHelper.GetConnectionString());
SqlCommand cmd = new SqlCommand(Stored_Procedure, cn);
for (int i = 0; i < nv.Count; i++)
{
SqlParameter param;
if (nv.Get(nv.AllKeys[i]) == null)
param = new SqlParameter(nv.AllKeys[i], DBNull.Value);
else
param = new SqlParameter(nv.AllKeys[i], nv.Get(nv.AllKeys[i]));
cmd.Parameters.Add(param);
}
cmd.CommandTimeout = 999999;
cmd.CommandType = CommandType.StoredProcedure;
SqlDataAdapter da = new SqlDataAdapter(cmd);
try
{
cn.Open();
da.Fill(ds);
}
catch (Exception ex)
{
da.Dispose();
cmd.Connection.Close();
cn.Close();
throw ex;
}
finally
{
da.Dispose();
cmd.Connection.Close();
cn.Close();
}
return ds;
}
{
System.Collections.Specialized.NameValueCollection nv = new System.Collections.Specialized.NameValueCollection();
nv.Add("@Id", ID);
nv.Add("@Type", Type);
nv.Add("@FromDate", FromDate);
nv.Add("@ToDate", ToDate);
DataLayer Obj = new DataLayer
return Obj .GetDataSet("statement", nv);
}
public DataSet GetDataSet(string Stored_Procedure, NameValueCollection nv)
{
DataSet ds = new DataSet();
SqlConnection cn = new SqlConnection(objDBHelper.GetConnectionString());
SqlCommand cmd = new SqlCommand(Stored_Procedure, cn);
for (int i = 0; i < nv.Count; i++)
{
SqlParameter param;
if (nv.Get(nv.AllKeys[i]) == null)
param = new SqlParameter(nv.AllKeys[i], DBNull.Value);
else
param = new SqlParameter(nv.AllKeys[i], nv.Get(nv.AllKeys[i]));
cmd.Parameters.Add(param);
}
cmd.CommandTimeout = 999999;
cmd.CommandType = CommandType.StoredProcedure;
SqlDataAdapter da = new SqlDataAdapter(cmd);
try
{
cn.Open();
da.Fill(ds);
}
catch (Exception ex)
{
da.Dispose();
cmd.Connection.Close();
cn.Close();
throw ex;
}
finally
{
da.Dispose();
cmd.Connection.Close();
cn.Close();
}
return ds;
}
No comments:
Post a Comment