Jump to content

database!


knowledgehungry

Recommended Posts

I am not sure what you mean. Do you mean you want to query the database once and then use the results over multiple pages? You couls save the data in sessions but unless it is a huge query then it would be easier to just query the database again. Also if it is a huge result set then saving it in sessions may be difficult.

Link to comment
Share on other sites

I am not sure what you mean. Do you mean you want to query the database once and then use the results over multiple pages? You couls save the data in sessions but unless it is a huge query then it would be easier to just query the database again. Also if it is a huge result set then saving it in sessions may be difficult.
yes excatly .whatever u have understood is true. i exactly want the solution for this !
Link to comment
Share on other sites

you could create a class something like the example below to manage your stored data

public class DataStorage{		public DataStorage()	{			}		private static DataSet StoreData()	{		DataSet ds = new DataSet();		SqlConnection conn = new SqlConnection("Connection String");		SqlDataAdapter da = new SqlDataAdapter("SELECT * FROM MyTable", conn);		conn.Open();		da.Fill(ds);		conn.Close();		Session["StoredDataSet"] = ds;		return ds;	}		public static DataSet StoredDatSet	{		get		{			object obj = Session["StoredDataSet"];			if(obj != null)				return (DataSet) obj;			DataSet ds = DataStorage.StoreData();			return ds;		}	}}

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...