How can pass dataset value from one form to another form dataset in asp.net using c# [Resolved]

Posted by Sekar.C under ASP.NET on 7/30/2012 | Points: 10 | Views : 9221 | Status : [Member] | Replies : 5
Hi,
How can pass dataset value from one form to another form dataset in asp.net using c#

Regards
Sekar.c



Responses

Posted by: Bhupentiwari on: 7/30/2012 [Member] Starter | Points: 50

Up
0
Down

Resolved
You can dataset to session object

SqlDataAdaptor dap = new SqlDataAdaptor(command,connection)

DataSet ds = new DataSet();
dap.Fill(ds);
Session.Add("Name", ds);


Now you can Retrive like this

ds = (DataSet)Session["Name"];






Thanks n Regards
Bhupendra Tiwari

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

Posted by: Sekar.C on: 7/30/2012 [Member] Starter | Points: 25

Up
0
Down
Hi Bhupendra Tiwari,

thak you .i got solution

Regards
Sekar.c

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

Posted by: Bhupentiwari on: 7/30/2012 [Member] Starter | Points: 25

Up
0
Down
Welcome... Mr Sekar C.

Thanks n Regards
Bhupendra Tiwari

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

Posted by: Sekar.C on: 7/30/2012 [Member] Starter | Points: 25

Up
0
Down
Hi,
Try this
 Download source file

Regards
Sekar.c

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

Posted by: Muktesh.Chavle on: 7/30/2012 [Member] Starter | Points: 25

Up
0
Down
If you do not want to use session then It can be done by using cache object. I have done this as-

Page1-
DataTable dt = GetData(); //This GetData function returns the datatable
DataSet ds = new DataSet();
ds.Tables.Add(dt);
Cache.Add("data", ds, null, Cache.NoAbsoluteExpiration, new TimeSpan(0, 1, 0), CacheItemPriority.Normal, null); //Here new TimeSpan(0, 1, 0) ensures the how much time object will be catched. Here it is 1 minute
Response.Redirect("Page2.aspx");


Page 2 -
DataSet data = (DataSet)Cache["data"];
GridView1.DataSource = data;
GridView1.DataBind();

Hope this will help :)

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

Login to post response