Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
OBINNA_EKE
Posting Yak Master
234 Posts |
Posted - 2006-07-18 : 04:15:16
|
What if I add more records to the Author table. how would CACHE know that I have added something, it will still be displaying old data Please explain and code will also helpvoid Page_Load(Object Src, EventArgs E) { DataView Source; Source = (DataView)Cache["MyDataSet"]; if (Source == null) { SqlConnection myConnection = new SqlConnection("server=(local)\\NetSDK;database=pubs;Trusted_Connection=yes"); SqlDataAdapter myCommand = new SqlDataAdapter("select * from Authors", myConnection); DataSet ds = new DataSet(); myCommand.Fill(ds, "Authors"); Source = new DataView(ds.Tables["Authors"]); Cache["MyDataSet"] = Source; CacheMsg.Text = "Dataset created explicitly"; } else { CacheMsg.Text = "Dataset retrieved from cache"; } MyDataGrid.DataSource=Source; MyDataGrid.DataBind(); } |
|
dfiala
Posting Yak Master
116 Posts |
|
OBINNA_EKE
Posting Yak Master
234 Posts |
Posted - 2006-07-18 : 07:02:46
|
I mean in 1.1 |
 |
|
dfiala
Posting Yak Master
116 Posts |
|
OBINNA_EKE
Posting Yak Master
234 Posts |
Posted - 2006-07-20 : 05:14:36
|
What if I declare Source as a Global VariableThen when doing an Insert or delete, I will set it to null like thisSource = null |
 |
|
dfiala
Posting Yak Master
116 Posts |
Posted - 2006-07-20 : 10:22:45
|
Sure, you could do that, but then you're not using the cache, and not accounting for updates, or outside changes to the database. Which all could be fine depending on what you're trying to accomplsih.Dean FialaVery Practical Software, IncNow with Blogging...http://www.vpsw.com/blogbabyMicrosoft MVP |
 |
|
|
|
|
|
|