N
needin4mation
I am inserting a row in a database. All that works fine. What I now
need is the last inserted id from the database. I can get that. Again
all working.
Then what I need to have is that same last inserted id key to be
available when the page reloads. When I press the button to insert the
data, I can do this:
Session("last")=LAST_ID;
Response.Write("My row id is: " + Session("last"));
//this works and is inside my INSERT button_click event
But when the Page_Load comes back I cannot see it. I try this:
if (Page.IsPostBack)
Response.Write("My row upon postback is: " + Session("last"));
//this fails upon postback in the Page_Load
It is just blank. Nothing there.
Instead of a Session variable, I have tried a static variable, (I think
ViewState, but am not sure), a global variable, nothing holds the data
upon PostBack.
Thank you for any help.
need is the last inserted id from the database. I can get that. Again
all working.
Then what I need to have is that same last inserted id key to be
available when the page reloads. When I press the button to insert the
data, I can do this:
Session("last")=LAST_ID;
Response.Write("My row id is: " + Session("last"));
//this works and is inside my INSERT button_click event
But when the Page_Load comes back I cannot see it. I try this:
if (Page.IsPostBack)
Response.Write("My row upon postback is: " + Session("last"));
//this fails upon postback in the Page_Load
It is just blank. Nothing there.
Instead of a Session variable, I have tried a static variable, (I think
ViewState, but am not sure), a global variable, nothing holds the data
upon PostBack.
Thank you for any help.