Pass DataTable To DAL

Posted by Sharpcnet under C# on 11/19/2013 | Points: 10 | Views : 2024 | Status : [Member] | Replies : 3
I would like to pass a datatable to the DataAccessLayer from aspx.cs page. DAL is another project and CountryDal is a class file in it. Unable to do it using the session object. What is the proper way to acheive this.
ASPX.CS

private countryDAL objDAL = new CountryDAL();

protected void btnSave_Click(object sender, EventArgs e)
{
//code...
Session["tbl"] = dt; //dt is a datatable with some data
objDAL.SaveTable();
}

DAL

public void SaveTable()
{
DataTable dtSave = (DataTable)Session["tbl"];

//code.....
}





Responses

Posted by: Bandi on: 11/20/2013 [Member] [MVP] Platinum | Points: 25

Up
0
Down
refer these links
http://stackoverflow.com/questions/2288299/storing-and-retrieving-datatable-from-session
http://www.codeproject.com/Articles/493389/Four-ways-of-passing-data-between-layers
http://stackoverflow.com/questions/16141165/can-we-pass-datatable-from-business-layer-to-presentation-layer

Mark This Response as Answer
--
Chandu
http://www.dotnetfunda.com/images/dnfmvp.gif

Sharpcnet, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Sharpcnet on: 11/20/2013 [Member] Starter | Points: 25

Up
0
Down
Fixed this.
We could just inject the dataTable through layers. My mistake was, I was sending a null table in the first place.

objDAL.SaveTable(dt);

public void SaveTable(DataTable dtSave)


Sharpcnet, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Bandi on: 11/20/2013 [Member] [MVP] Platinum | Points: 25

Up
0
Down
Glad that you only sorted out the issue

Mark This Response as Answer
--
Chandu
http://www.dotnetfunda.com/images/dnfmvp.gif

Sharpcnet, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response