Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
hi am using dynamic in my web application..
am using user control(BidTree)
i want to save this user controls values from session to sql table can any one suggest me how to give code to save into sql table.
 
thanks.
Posted 7-Jun-12 23:13pm
ythisbug2.1K
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

Adding DataTable into Session:
DataTable Tissues = new DataTable();
 
Tissues = dal.returnTissues("TestID", "TestValue");// returnTissues("","") sample     function for adding values

Session.Add("Tissues", Tissues);
 
Retrive that datatable from session:
DataTable Tissues = Session["Tissues"] as DataTable
Or
DataTable Tissues = (DataTable)Session["Tissues"];
Ref:Storing and retrieving datatable from session[^]
  Permalink  
Comments
ythisbug at 8-Jun-12 5:42am
   
thanks can u explain me,.wat is TestID,TestValue ?
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

Lets say you have a datatable ad you want to save it, say Dt.
Session["myTable"] = Dt;
Now on the page where you need to access it:
DataTable table = Session["myTable"] as DataTable;
 
if(table != null)
{
 //read table and push in Sqlserver
}
else
{
 //session either expired or invalid page being accessed.
}
I hope it helps. let me know if you need more.
  Permalink  

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 Dnyaneshwar@Pune 1,300
1 Sergey Alexandrovich Kryukov 660
2 OriginalGriff 329
3 ravikhoda 300
4 Manas Bhardwaj 240
0 Sergey Alexandrovich Kryukov 11,194
1 OriginalGriff 6,867
2 Peter Leow 4,795
3 Abhinav S 3,838
4 Maciej Los 3,575


Advertise | Privacy | Mobile
Web01 | 2.8.140421.2 | Last Updated 8 Jun 2012
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Use
Layout: fixed | fluid