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.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 A temporary database

Author  Topic 

cesark
Posting Yak Master

215 Posts

Posted - 2004-02-10 : 04:22:53
Hi !

I use Sql 2000 Server as a database and an ASP.NET application with VB.NET language.

Now I am working with three pages with one form in every page that allows to register a user. To accomplish the registration the user needs to fill all the three pages, but now I am sending the data to the database in every page, so if a user leaves the process before reaching the third page it will have an invalid user entry into the database that I don’ t want. To avoid this I was recommended to store the in a temporary database file. I have been searching information about this but I have not found it.

Somebody can help me finding the necessary documentation to achieve it please?


Thanks

ravilobo
Master Smack Fu Yak Hacker

1184 Posts

Posted - 2004-02-10 : 04:34:25
Can't you store the data in ASP sessions? DB option will be slower.
Search BOL for tempdb ...

------------------------
I think, therefore I am
Go to Top of Page

mohdowais
Sheikh of Yak Knowledge

1456 Posts

Posted - 2004-02-10 : 04:39:57
There are many ways of accomplishing what you want, but I guess a temporary database does not figure in that - primarily because you won't have huge amounts of data to justify the overhead of creating a temporary database. At the database end, you could use a set of "Staging tables" to store the data and when the user completes the process you call a Stored Proc to copy that data into the proper tables. Your staging tables will generally have the same structure as the final tables, but will be used a temporary holding area until you are sure this data needs to be saved. It is basically the same concept that is used for shopping carts in e-commerce sites. You could also write a proc to run every couple of days and delete records that have been lying around for some time.

You might not even need to do this at the database level. In the web application, you could save the data in a Dataset stored in Viewstate or as a Session variable or persisted as an XML file, and then saved to the database when the user completes the process. Each of these methods has its limitations, you need to decide what is best for you depending on the complexity, requirements, number of users, etc.

OS
Go to Top of Page

cesark
Posting Yak Master

215 Posts

Posted - 2004-02-10 : 05:38:56
Ok, I think that I will choose to store the data as a session variable or similar if it runs good. I don' t have any idea about "Staging tables", so I don' t want to complicate things.
I suppose that "Staging tables" are for many users entries and for checking data before to record the data, isn' t it?

Go to Top of Page

mohdowais
Sheikh of Yak Knowledge

1456 Posts

Posted - 2004-02-10 : 07:16:05
Yes, staging tables serve quite a few useful purposes. But I see them suitable for your reqirements, can't you more than one user registering at the same time? Also, be aware that session variables use valuable RAM on the web server so storing a large dataset in memory will hurt scalability. You could use Viewstate, but that will dramatically increase the data sent to the client resulting in longer loading times.

OS
Go to Top of Page

robvolk
Most Valuable Yak

15732 Posts

Posted - 2004-02-10 : 07:39:15
Really the best way to handle this is to not store anything in the database until the user completes all of the forms. You can store all of the data in a regular disconnected dataset, or plain old session variables or cookies. This completely sidesteps the problem of having incomplete data in the database.
Go to Top of Page

ehorn
Master Smack Fu Yak Hacker

1632 Posts

Posted - 2004-02-10 : 07:45:13
Here is a link to Microsofts Patterns and Practices - "Managing state in .NET web applications":

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnpag/html/diforwc-ch05.asp
Go to Top of Page

cesark
Posting Yak Master

215 Posts

Posted - 2004-02-10 : 11:12:16
Thank you very much to everyone !
Go to Top of Page
   

- Advertisement -