where should I save temporary values

M

Mario Krsnic

Hello!
I have made an application where user can get reading after entering his
name and the name of his partner. I tried to save the names in the database,
in the separate table. My solution:
AccessDataSource1.InsertCommand = "INSERT INTO var(var1) VALUES ('" &
Trim(TextBox1.Text) & "')" 'his name
AccessDataSource1.UpdateCommand = "UPDATE [var] SET [var2] = '" &
Trim(TextBox1.Text) & "' WHERE [id] = (select max(id)from var)" 'her name
and then on the second page:
AccessDataSource1.SelectCommand = "select var1,var2 from var WHERE [id] =
(select max(id)from var)" 'both names
This works fine, when not more users try to work with it at the same time.
Is there better solution for such temporary values? Would it be better to
save this values locally? How to do it?
Thank you
Mario
 
S

Scott M.

Is this application specific data? If so, put it in the application cache:

cache.insert("partnerName", data)

and retreive it with cache("partnerName")

if it is user specfic data, put it into session state or viewstate:

viewstate.add("partnerName", data)

and retreive with viewstate("partnerName")
 
E

Eliyahu Goldin

Viewstate won't help the second page to retrieve the data from the first
one. Use session variables.

--
Eliyahu Goldin,
Software Developer & Consultant
Microsoft MVP [ASP.NET]


Scott M. said:
Is this application specific data? If so, put it in the application
cache:

cache.insert("partnerName", data)

and retreive it with cache("partnerName")

if it is user specfic data, put it into session state or viewstate:

viewstate.add("partnerName", data)

and retreive with viewstate("partnerName")




Mario Krsnic said:
Hello!
I have made an application where user can get reading after entering his
name and the name of his partner. I tried to save the names in the
database, in the separate table. My solution:
AccessDataSource1.InsertCommand = "INSERT INTO var(var1) VALUES ('" &
Trim(TextBox1.Text) & "')" 'his name
AccessDataSource1.UpdateCommand = "UPDATE [var] SET [var2] = '" &
Trim(TextBox1.Text) & "' WHERE [id] = (select max(id)from var)" 'her
name
and then on the second page:
AccessDataSource1.SelectCommand = "select var1,var2 from var WHERE [id] =
(select max(id)from var)" 'both names
This works fine, when not more users try to work with it at the same
time.
Is there better solution for such temporary values? Would it be better to
save this values locally? How to do it?
Thank you
Mario
 
M

Mario Krsnic

Thank you!

Eliyahu Goldin said:
Viewstate won't help the second page to retrieve the data from the first
one. Use session variables.

--
Eliyahu Goldin,
Software Developer & Consultant
Microsoft MVP [ASP.NET]


Scott M. said:
Is this application specific data? If so, put it in the application
cache:

cache.insert("partnerName", data)

and retreive it with cache("partnerName")

if it is user specfic data, put it into session state or viewstate:

viewstate.add("partnerName", data)

and retreive with viewstate("partnerName")




Mario Krsnic said:
Hello!
I have made an application where user can get reading after entering
his name and the name of his partner. I tried to save the names in the
database, in the separate table. My solution:
AccessDataSource1.InsertCommand = "INSERT INTO var(var1) VALUES ('" &
Trim(TextBox1.Text) & "')" 'his name
AccessDataSource1.UpdateCommand = "UPDATE [var] SET [var2] = '" &
Trim(TextBox1.Text) & "' WHERE [id] = (select max(id)from var)" 'her
name
and then on the second page:
AccessDataSource1.SelectCommand = "select var1,var2 from var WHERE [id]
= (select max(id)from var)" 'both names
This works fine, when not more users try to work with it at the same
time.
Is there better solution for such temporary values? Would it be better
to save this values locally? How to do it?
Thank you
Mario
 
S

Scott M.

But, if this is not a multi-page scenario, ViewState is better because it
takes less server resources. Which is why I offered both as potential
candidates.


Eliyahu Goldin said:
Viewstate won't help the second page to retrieve the data from the first
one. Use session variables.

--
Eliyahu Goldin,
Software Developer & Consultant
Microsoft MVP [ASP.NET]


Scott M. said:
Is this application specific data? If so, put it in the application
cache:

cache.insert("partnerName", data)

and retreive it with cache("partnerName")

if it is user specfic data, put it into session state or viewstate:

viewstate.add("partnerName", data)

and retreive with viewstate("partnerName")




Mario Krsnic said:
Hello!
I have made an application where user can get reading after entering
his name and the name of his partner. I tried to save the names in the
database, in the separate table. My solution:
AccessDataSource1.InsertCommand = "INSERT INTO var(var1) VALUES ('" &
Trim(TextBox1.Text) & "')" 'his name
AccessDataSource1.UpdateCommand = "UPDATE [var] SET [var2] = '" &
Trim(TextBox1.Text) & "' WHERE [id] = (select max(id)from var)" 'her
name
and then on the second page:
AccessDataSource1.SelectCommand = "select var1,var2 from var WHERE [id]
= (select max(id)from var)" 'both names
This works fine, when not more users try to work with it at the same
time.
Is there better solution for such temporary values? Would it be better
to save this values locally? How to do it?
Thank you
Mario
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,775
Messages
2,569,601
Members
45,182
Latest member
alexanderrm

Latest Threads

Top