A dataset is saved in session state. Then the dataset is filled out with the
new records using a dataadapter. It appears then that the dataset saved in
session state contains the new records even without saving the updated
dataset.
Why does this happen? How can I preserve the dataset saved in session state
from automatical updating?
Thank you. 6 5126
a code snip on how you are trying to use it would help. From my current
understanding here's what i think:
when you add objects to session they are added by value and not by
reference. ie one that you are refering to in you code is a local copy of
the object stored session.
any changes to the local copy would not be updated directly. you will need
to manually update the object in session.
--
Regards,
HD
Once a Geek.... Always a Geek
"Vik" <viktorum@==hot mail.com==> wrote in message
news:ed******** *****@tk2msftng p13.phx.gbl... A dataset is saved in session state. Then the dataset is filled out with the new records using a dataadapter. It appears then that the dataset saved in session state contains the new records even without saving the updated dataset.
Why does this happen? How can I preserve the dataset saved in session state from automatical updating?
Thank you.
Thank you Hermit. Here is my code.
SqlDataAdapter1 and DataSet11 are created in design time.
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArg s) Handles MyBase.Load
'Put user code to initialize the page here
Dim N0, N1, N2 As Int16, Str1, Str2 As String, DS As DataSet
Session("DS") = DataSet11
N0 = DataSet11.Table s(0).Rows.Count 'N0=0
SqlDataAdapter1 .Fill(DataSet11 )
DS = Session("DS")
N1 = DataSet11.Table s(0).Rows.Count 'N1=3
N2 = DS.Tables(0).Ro ws.Count 'N2=3
Str1 = DataSet11.Table s(0).Rows(1)(1) 'Str1="Other"
Str2 = DS.Tables(0).Ro ws(1)(1) 'Str2="Other"
End Sub
So, the dataset is saved in session state only once when it is empty. After
the dataset is filled out its saved copy has all the new records. What I
need and expected is that the dataset in session state keeps the old records
(remains empty in this case) when the real dataset is updated.
Vik
"Hermit Dave" <he************ @CAPS.AND.DOTS. hotmail.com> wrote in message
news:%2******** ********@TK2MSF TNGP11.phx.gbl. .. a code snip on how you are trying to use it would help. From my current understanding here's what i think:
when you add objects to session they are added by value and not by reference. ie one that you are refering to in you code is a local copy of the object stored session. any changes to the local copy would not be updated directly. you will need to manually update the object in session.
-- Regards, HD Once a Geek.... Always a Geek "Vik" <viktorum@==hot mail.com==> wrote in message news:ed******** *****@tk2msftng p13.phx.gbl...A dataset is saved in session state. Then the dataset is filled out with the new records using a dataadapter. It appears then that the dataset saved
in session state contains the new records even without saving the updated dataset.
Why does this happen? How can I preserve the dataset saved in session state from automatical updating?
Thank you.
i see what you mean now.
try using
Session("DS") = DataSet11.Copy( )
that way you are explicitly saving a copy. I will have a play around with
this later on.
--
Regards,
HD
Once a Geek.... Always a Geek
"Vik" <viktorum@==hot mail.com==> wrote in message
news:%2******** *******@TK2MSFT NGP11.phx.gbl.. . Thank you Hermit. Here is my code.
SqlDataAdapter1 and DataSet11 are created in design time. Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArg s) Handles MyBase.Load
'Put user code to initialize the page here
Dim N0, N1, N2 As Int16, Str1, Str2 As String, DS As DataSet
Session("DS") = DataSet11
N0 = DataSet11.Table s(0).Rows.Count 'N0=0
SqlDataAdapter1 .Fill(DataSet11 )
DS = Session("DS")
N1 = DataSet11.Table s(0).Rows.Count 'N1=3
N2 = DS.Tables(0).Ro ws.Count 'N2=3
Str1 = DataSet11.Table s(0).Rows(1)(1) 'Str1="Other"
Str2 = DS.Tables(0).Ro ws(1)(1) 'Str2="Other"
End Sub
So, the dataset is saved in session state only once when it is empty. After the dataset is filled out its saved copy has all the new records. What I need and expected is that the dataset in session state keeps the old records (remains empty in this case) when the real dataset is updated.
Vik
"Hermit Dave" <he************ @CAPS.AND.DOTS. hotmail.com> wrote in message news:%2******** ********@TK2MSF TNGP11.phx.gbl. .. a code snip on how you are trying to use it would help. From my current understanding here's what i think:
when you add objects to session they are added by value and not by reference. ie one that you are refering to in you code is a local copy of the object stored session. any changes to the local copy would not be updated directly. you will need to manually update the object in session.
-- Regards, HD Once a Geek.... Always a Geek "Vik" <viktorum@==hot mail.com==> wrote in message news:ed******** *****@tk2msftng p13.phx.gbl... >A dataset is saved in session state. Then the dataset is filled out with >the > new records using a dataadapter. It appears then that the dataset saved in > session state contains the new records even without saving the updated > dataset. > > Why does this happen? How can I preserve the dataset saved in session > state > from automatical updating? > > Thank you. > >
Thank you. This works.
Vik
"Hermit Dave" <he************ @CAPS.AND.DOTS. hotmail.com> wrote in message
news:ey******** ******@tk2msftn gp13.phx.gbl... i see what you mean now.
try using
Session("DS") = DataSet11.Copy( )
that way you are explicitly saving a copy. I will have a play around with this later on.
-- Regards, HD Once a Geek.... Always a Geek "Vik" <viktorum@==hot mail.com==> wrote in message news:%2******** *******@TK2MSFT NGP11.phx.gbl.. . Thank you Hermit. Here is my code.
SqlDataAdapter1 and DataSet11 are created in design time. Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArg s) Handles MyBase.Load
'Put user code to initialize the page here
Dim N0, N1, N2 As Int16, Str1, Str2 As String, DS As DataSet
Session("DS") = DataSet11
N0 = DataSet11.Table s(0).Rows.Count 'N0=0
SqlDataAdapter1 .Fill(DataSet11 )
DS = Session("DS")
N1 = DataSet11.Table s(0).Rows.Count 'N1=3
N2 = DS.Tables(0).Ro ws.Count 'N2=3
Str1 = DataSet11.Table s(0).Rows(1)(1) 'Str1="Other"
Str2 = DS.Tables(0).Ro ws(1)(1) 'Str2="Other"
End Sub
So, the dataset is saved in session state only once when it is empty. After the dataset is filled out its saved copy has all the new records. What I need and expected is that the dataset in session state keeps the old records (remains empty in this case) when the real dataset is updated.
Vik
"Hermit Dave" <he************ @CAPS.AND.DOTS. hotmail.com> wrote in
message news:%2******** ********@TK2MSF TNGP11.phx.gbl. .. a code snip on how you are trying to use it would help. From my current understanding here's what i think:
when you add objects to session they are added by value and not by reference. ie one that you are refering to in you code is a local copy
of the object stored session. any changes to the local copy would not be updated directly. you will need to manually update the object in session.
-- Regards, HD Once a Geek.... Always a Geek "Vik" <viktorum@==hot mail.com==> wrote in message news:ed******** *****@tk2msftng p13.phx.gbl... >A dataset is saved in session state. Then the dataset is filled out
with >the > new records using a dataadapter. It appears then that the dataset
saved in > session state contains the new records even without saving the
updated > dataset. > > Why does this happen? How can I preserve the dataset saved in session > state > from automatical updating? > > Thank you. > >
Is it possible to release memory occupied by a Session object? E.g. will
this work: Session("DS") = Nothing ?
Vik
"Hermit Dave" <he************ @CAPS.AND.DOTS. hotmail.com> wrote in message
news:ey******** ******@tk2msftn gp13.phx.gbl... i see what you mean now.
try using
Session("DS") = DataSet11.Copy( )
that way you are explicitly saving a copy. I will have a play around with this later on.
-- Regards, HD Once a Geek.... Always a Geek "Vik" <viktorum@==hot mail.com==> wrote in message news:%2******** *******@TK2MSFT NGP11.phx.gbl.. . Thank you Hermit. Here is my code.
SqlDataAdapter1 and DataSet11 are created in design time. Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArg s) Handles MyBase.Load
'Put user code to initialize the page here
Dim N0, N1, N2 As Int16, Str1, Str2 As String, DS As DataSet
Session("DS") = DataSet11
N0 = DataSet11.Table s(0).Rows.Count 'N0=0
SqlDataAdapter1 .Fill(DataSet11 )
DS = Session("DS")
N1 = DataSet11.Table s(0).Rows.Count 'N1=3
N2 = DS.Tables(0).Ro ws.Count 'N2=3
Str1 = DataSet11.Table s(0).Rows(1)(1) 'Str1="Other"
Str2 = DS.Tables(0).Ro ws(1)(1) 'Str2="Other"
End Sub
So, the dataset is saved in session state only once when it is empty. After the dataset is filled out its saved copy has all the new records. What I need and expected is that the dataset in session state keeps the old records (remains empty in this case) when the real dataset is updated.
Vik
"Hermit Dave" <he************ @CAPS.AND.DOTS. hotmail.com> wrote in
message news:%2******** ********@TK2MSF TNGP11.phx.gbl. .. a code snip on how you are trying to use it would help. From my current understanding here's what i think:
when you add objects to session they are added by value and not by reference. ie one that you are refering to in you code is a local copy
of the object stored session. any changes to the local copy would not be updated directly. you will need to manually update the object in session.
-- Regards, HD Once a Geek.... Always a Geek "Vik" <viktorum@==hot mail.com==> wrote in message news:ed******** *****@tk2msftng p13.phx.gbl... >A dataset is saved in session state. Then the dataset is filled out
with >the > new records using a dataadapter. It appears then that the dataset
saved in > session state contains the new records even without saving the
updated > dataset. > > Why does this happen? How can I preserve the dataset saved in session > state > from automatical updating? > > Thank you. > >
you certainly can
--
Regards,
HD
Once a Geek.... Always a Geek
"Vik" <viktorum@==hot mail.com==> wrote in message
news:uK******** ******@TK2MSFTN GP12.phx.gbl... Is it possible to release memory occupied by a Session object? E.g. will this work: Session("DS") = Nothing ?
Vik
"Hermit Dave" <he************ @CAPS.AND.DOTS. hotmail.com> wrote in message news:ey******** ******@tk2msftn gp13.phx.gbl... i see what you mean now.
try using
Session("DS") = DataSet11.Copy( )
that way you are explicitly saving a copy. I will have a play around with this later on.
-- Regards, HD Once a Geek.... Always a Geek "Vik" <viktorum@==hot mail.com==> wrote in message news:%2******** *******@TK2MSFT NGP11.phx.gbl.. . > Thank you Hermit. Here is my code. > > SqlDataAdapter1 and DataSet11 are created in design time. > Private Sub Page_Load(ByVal sender As System.Object, ByVal e As > System.EventArg s) Handles MyBase.Load > > 'Put user code to initialize the page here > > Dim N0, N1, N2 As Int16, Str1, Str2 As String, DS As DataSet > > Session("DS") = DataSet11 > > N0 = DataSet11.Table s(0).Rows.Count 'N0=0 > > SqlDataAdapter1 .Fill(DataSet11 ) > > DS = Session("DS") > > N1 = DataSet11.Table s(0).Rows.Count 'N1=3 > > N2 = DS.Tables(0).Ro ws.Count 'N2=3 > > Str1 = DataSet11.Table s(0).Rows(1)(1) 'Str1="Other" > > Str2 = DS.Tables(0).Ro ws(1)(1) 'Str2="Other" > > End Sub > > So, the dataset is saved in session state only once when it is empty. > After > the dataset is filled out its saved copy has all the new records. What > I > need and expected is that the dataset in session state keeps the old > records > (remains empty in this case) when the real dataset is updated. > > Vik > > "Hermit Dave" <he************ @CAPS.AND.DOTS. hotmail.com> wrote in message > news:%2******** ********@TK2MSF TNGP11.phx.gbl. .. >> a code snip on how you are trying to use it would help. From my >> current >> understanding here's what i think: >> >> when you add objects to session they are added by value and not by >> reference. ie one that you are refering to in you code is a local copy of >> the object stored session. >> any changes to the local copy would not be updated directly. you will >> need >> to manually update the object in session. >> >> -- >> Regards, >> HD >> Once a Geek.... Always a Geek >> "Vik" <viktorum@==hot mail.com==> wrote in message >> news:ed******** *****@tk2msftng p13.phx.gbl... >> >A dataset is saved in session state. Then the dataset is filled out with >> >the >> > new records using a dataadapter. It appears then that the dataset saved > in >> > session state contains the new records even without saving the updated >> > dataset. >> > >> > Why does this happen? How can I preserve the dataset saved in >> > session >> > state >> > from automatical updating? >> > >> > Thank you. >> > >> > >> >> > >
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Filippo Pandiani |
last post by:
I have a grid that shows the file list from a folder.
On the postback, how do I get a Dataset from this grid?
Thanks,
Filippo.
|
by: Martin |
last post by:
Hi!
I'm new to ASP.NET WebApplications and wonder whether I've missed
something out when programming it. I'm grateful for any hints to this
problem!
Thanks very much for your efforts!
Martin
Description:
|
by: Arthur Dzhelali |
last post by:
Is there any way to cache dataset on one page and it will be accessible for
one user?
if you declare dataset shared it will stay on the server and page will be
able reference to it on reload, but in this case it will be shared with
other users who use the page.
Right now I found work around it by saving each dataset as xml file with
users's sessionid in file name and reading it on page reload.
is there a better way?
|
by: jhill |
last post by:
i have a dataset object i put on my webform, i fill the dataset, bind it to my grid. the grid displays with my data. i put a button with no code in it, but just to have it force a postback. every time this happens, my dataset is set to nothing
for the fun of it, i created 2 datasets and left one of them 'untouched', meaning it wasn't bound to anything... just filled with data. sure enough, it reset to "nothing" on a postback. this is...
|
by: Ryu |
last post by:
Is there any way to share a DataSet across more than 1 page? Do I have to
retrieve the same Dataset everytime I go to a new page? Please advice,
thanks
| |
by: Czar Eclarinal |
last post by:
Hi Everyone,
I've declared a datatable out of my typed dataset stored in session and add
a new row to it. When state management is set to InProc and I modified the
declared dataable, the changes reflect to the dataset. But when the session
is OutProc (using SQL) , the changes doesnt reflect. For e.g.
Sub Page_Load
myDataSet AS myTypedDataSet
|
by: Dhruba Bandopadhyay |
last post by:
I have a DataGrid which has checkbox columns. The data source is a run-time
created data set that I store in a session so I can rebind it during
postbacks. I don't have a database or xml file, etc.
I am wondering if it's possible to edit a dataset directly? So when I click
on a checkbox it will change the value in the dataset and store it back into
session?
If this is not possible how can I use arrays or vectors to temporary store
my...
|
by: =?Utf-8?B?cGF0cmlja2RyZA==?= |
last post by:
Hi everyone?
Which is considered to be the 'best' way to cache a dataset and/or a crystal
reports reportdocument object?
ViewState? Session? Something else?
Thanks in advance!
|
by: zhshqzyc |
last post by:
I am going to past a dataset from First.aspx to Second.aspx.
A whole table will be displayed on First.aspx and partial columns
will be displayed on Second.aspx.
First.aspx view in browser works well if I exclude Second.aspx. But when Second.aspx is included in the project, an error happens.
I can't find what is wrong in my code.
System.NullReferenceException was unhandled by user code
Message="Object reference not set to an...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
| |
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |