C# .NET - How to pass the dataset values with session into another page

Asked By karthik karthik
09-Sep-10 04:20 AM
Hai Friends

In my page i am having three dataset for  eg ds,ds1.ds2.these three dataset values i am redirecting to a another page with the session name like this eg:session["karthik"].in that page i want that three dataset values how to do this.
tx in advance
  Sagar P replied to karthik karthik
09-Sep-10 04:24 AM
Better way to use 3 session values like;

Session["DataSet1"]= ds1;
Session["DataSet2"]= ds2;
Session["DataSet3"]= ds3;

And on other page you can use it like;

DataSet ds1 = (DataSet)Session["DataSet1"];
DataSet ds2 = (DataSet)Session["DataSet2"];
DataSet ds3 = (DataSet)Session["DataSet3"];
  Reena Jain replied to karthik karthik
09-Sep-10 05:05 AM
hi,

if you want to pass specific value then do this

session["karthik"]=ds1.Tables[0].[0][0].tostring();


hope this will also help you
  Anand Malli replied to karthik karthik
09-Sep-10 05:48 AM
Hi Karthik

Why you are taking three datasets??? I mean do al dataset contain more then one table in it?? what i would suggest it to use one dataset and put all your datatable collection in one dataset only,so you can easily manage the things

i do not know how much i know abt your requirement but i think you can combine them in one datasetmand otherwise Session["karthik"]=ds1; is the solution to your problem

let me know
thxs
  Goniey N replied to karthik karthik
10-Sep-10 02:09 AM
-- Try Below


-- In "my page.aspx"...

Session["karthik"] = ds;

            
-- In "another page.aspx"...
-- Here For Dataset You have To Use "System.Data" namespace So If You Not Use It Then You Can Write Directly Below Code Or If You Use Then You Can Use Directly "DataSet"...

System.Data.DataSet ds = (System.Data.DataSet)Session["karthik"];


-- Hope This Help You....            
Create New Account
help
hoe to merge the two dataset into one dataset in c# hai friends I am one dataset like this ds like three columns this: - -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- tblkey Empkey Empname - -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- - T101 E10 Natraj T102 E11 Siva T103 E14 ganesh I am having another dataset ds1 only two columns like this: - -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- Empkey Empname E10 karthi E11 thriu E13 maran i waant merge the dataset and check the values while checking if ds is not having E13 it should bind both left and right outer joins. The joined table will contain all records from both tables, and fill in NULLs for missing matches on either side. You can find how to do full join on two data tables on this Article . Karthik, The following code will show you how to merge the data from the datasets. I
how to merge the two dataset without duplicates hai freinds I am having two datasets like this: ds TBLKEY EMPKEY EMPNAME ds2 TBLKEY EMPKEY EMPNAME 1 101 RAJA 2 105 POOJA 3 106 THRIU 4 109 karthik 5 110 hari i shoud get a output in ds like this here there is this TBLKEY EMPKEY EMPNAME 1 101 RAJA 2 105 POOJA 3 106 THRIU 4 109 karthik 5 110 hari I think you have to write your own logic for this. . . . See this function; public static DataSet MergeResultSets() { DataSet ds = null; int checkCount = 0; string rowPosition = ""; try { ds = DAL.DataAcess.Sample(param1, param2); for int i = 0; i < = ds.Tables[0].Rows.Count - 1; i++) { for (int j = 0; j < = ds.Tables[1].Rows.Count - 1; j++) { if (Equals(ds.Tables[0].Rows[i].ItemArray().Count, ds.Tables[1].Rows[j].ItemArray().Count)) { for (int k
to get all the records int result DATATABLE Result(RID, C_Grp, C_Type) var PMBQuery = ds1.Tables[ "PMB" ].AsEnumerable(); var MosQuery = ds1.Tables[ "Mos" ].AsEnumerable(); var query = ( from m in MosQuery join p in PMBQuery on m.Field need a join two datatables and get the resulting datatable having columns from both input tables. Thanks You can join two or more table in query and get column which you need this is working in my project / / Join 3 tables and show couple fields from each DataClasses1DataContext dcx = new DataClasses1DataContext(connectionString); var joined = from ord and Csv files. Hai Instead Of using the Linq to Datatable U Can use the dataset Merge Concept Like this: - -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- - For Eg tablename1, tablename2 Contains like this records: - -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- - TBLKEY EMPKEY EMPNAME 1 101 RAJA 2 105 POOJA 3 106 THRIU EMPKEY EMPNAME tablename2 - -- -- -- -- -- -- -- -- -- -- -- -- -- -- - - -- -- -- -- -- -- -- -- -- -- -- -- -- -- - 102 RAJA 103 KARTHIK 105 POOJA 109 ROJA this .Page.Unload + = new EventHandler (Page_Unload); sconn.Open(); DataSet ds = new DataSet (); SqlDataAdapter da = new SqlDataAdapter ( "SELECT * from tablename1" , sconn); da.Fill(ds); da = new SqlDataAdapter ( "SELECT
e) { MessageBox.Show(comboBox1.SelectedIndex.ToString()); } Thanks, Nowshad hi for ( int i = 0; i < ds.Tables[0].Rows.Count; i++) { DropDownList1.Items[i].Attributes.Add( "Title" , ds.Tables[0].Rows[i][ "empname" ].ToString()); } DropDownList1.ToolTip = DropDownList1.SelectedItem.Text; try This this will come item. but what i need is on the items in the dropdown. Thanks for replying karthik. What i need is on combobox dropdown in C#.NET that too on dropdown items da = new SqlDataAdapter ( "select tblkey+' '+empkey as final, empname from tablename11 order by tblkey" , con); DataSet ds = new DataSet (); da.Fill(ds); DropDownList1.DataSource = ds.Tables[0]; DropDownList1.DataValueField = "final" ; DropDownList1.DataTextField = "final" ; DropDownList1.DataBind(); for ( int i = 0; i < ds.Tables[0].Rows.Count; i++) { DropDownList1.Items[i].Attributes.Add( "Title" , ds Tables[0].Rows[i][ "empname" ].ToString()); } DropDownList1.ToolTip = DropDownList1.SelectedItem.Text; actually in this coding what