I'm trying to call a base class specifically; Release class into a Page_load method.The release class is linked to a baseclass which contains a method Dataset Getresult.
How do i call from the release class into the page load.I'm using Repeater
I'm trying to do something like this
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
//is this the correct way to do it?
Release release = new Release();
release.GetResult();// but GetResult() doesn't show when i try to create it
DataSet ds = new DataSet();
da.Fill(ds);
Repeater1.DataSource = ds;
Repeater1.DataBind();
}
}
Here's the code for GetResult()
protected DataSet GetResult()
{
SqlConnection scn = new SqlConnection(connect);
SqlCommand spcmd = new SqlCommand(_sp, scn);
spcmd.CommandType = CommandType.StoredProcedure;
foreach (KeyValuePair<string, string> pair in sql_params)
{
spcmd.Parameters.AddWithValue(pair.Key, pair.Value);
}
Clear();
SqlDataAdapter da = new SqlDataAdapter(spcmd);
DataSet ds = new DataSet();
scn.Open();
da.Fill(ds);
scn.Close();
return ds;
}
What do i need to do to call the method from GetResult into the page_load,do i need to declare a stored procedure and bind it to my html?