Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Best way to track our users in database while filling out web form.

Status
Not open for further replies.

milliKidd

Programmer
Jul 24, 2008
10
US
Hello everyone,
I need a way to keep track of our users in the database as they're filling out our web form. I have several asp.net pages and a table in the database for each page. So as the user is moving from page to page, I need to keep track of that so their information won't get mixed up with someone else's. Does that make sense? I am creating what I call a token here:
Code:
Private Function CreateUserID()

        Dim str As New StringBuilder(Left(tbLastName.Text, 3))
        Dim currentDate As Date = Now
        Dim [ReturnValue] As String

        str.Append(currentDate.ToString("MMMddyy"))
        str.Append(Right(mstbSSN.Text, 4))
        str.Append(currentDate.ToString("hhmmssff"))

        [ReturnValue] = str.ToString.ToUpper
        Return [ReturnValue]

End Function
The original message can be seen here:
But no one has answered me over there yet so I was going to post this in the ASP.Net forum. I'm desperate.

Thanks in advance,

milli

BTW, I'm using Visual Studio 2005 and dumping to a SQL Server 2000 database. ANY, ANY information will be GREATLY appreciated, I have posted this question to several forums but to no avail.
 
use a GUID for your token, it's much simpler and guaranteed not to duplicate. The idea of building a key with significance is overrated. Sound good at first, but it's a pain to maintain. GUIDs are as simple as Guid.NewGuid();

As for how to store the data. your current db structure will require modification when you need to make modifications to the GUI. I would try a table structure like this

Code:
UserInstance
-------------
Id guid (PK)
UserName string

StepInstance
-------------
Id long (pk)
UserInstanceId guid (fk to userinstance)
ScreenId int (fk to screen table)

FieldInstance
-------------
Id long (pk)
StepInstanceId long (fk to step instance)
NameOfControl string
ValueOfControl string
now you can add/remove screens fields as necessary without changing the table schema

create logic in your system to parse the values and build the form back out.

Jason Meckley
Programmer
Specialty Bakers, Inc.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top