Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 260
  • Last Modified:

Multipage web app with multi SQL tables.

.Net experts out there, what do you guys do when you're building a multi-page web form and wiring it to a SQL database? Please help. This is my first major project and I am at a loss here. Sorry, I'm a newb. Oh and I have a table for each page. So like the first page is called demographics.aspx and it dumps to a table called Data_Demographics; the second page is called employment.aspx and dumps to a table called Data_Employment. So I'm creating what I call a "Token" like this:
Private Function CreateUserID()    'or could be called CreateToken()
       
        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
And that's how I would like to keep track of each user in the database if possible. Can anyone out there help me out or have a better suggestion?

Very much appreciated in advance.

RFR
0
RunForrestRun
Asked:
RunForrestRun
  • 3
  • 2
1 Solution
 
AielloJCommented:
RunForrestRun:

Before you address your coding question, I'm concerned about your statement that there's a table for each web page.  I suspect that your data page layout coincidently happens to match a proper data model.  Your data model (How information relates to other information) is one of the biggest - if not the biggest - critical success factors in ANY database application.  Try Googling "data model concepts" and do some studying, especially the "Rules of Normalization."  Tables are created around "entities" - not the physical design of data input or display pages.

It appears you're trying to identify people by tokens made up of parts of their names, dates, and times.  These schemes usually end up not working as duplicate tokens can get generated, and they end up being a coding nightmare.  Most database tables have an ID which is an automatically generated large sequential number for identifying table rows.

Do some studying of data modeling and rework your design to what you learn from that.
0
 
AielloJCommented:
RunForrestRun:

REPOST WITH CORRECTIONS

Before you address your coding question, I'm concerned about your statement that there's a table for each web page.  I things the odds are pretty improbable that your data page layout coincidently happens to match a proper data model.  Your data model (How information relates to other information) is one of the biggest - if not the biggest - critical success factors in ANY database application.  Try Googling "data model concepts" and do some studying, especially the "Rules of Normalization."  Tables are created around "entities" - not the physical design of data input or display pages.

It appears you're trying to identify people by tokens made up of parts of their names, dates, and times.  These schemes usually end up not working as duplicate tokens can get generated, and they end up being a coding nightmare.  Most database tables have an ID which is an automatically generated large sequential number for identifying table rows.

Do some studying of data modeling and rework your design to what you learn from that.
0
 
RunForrestRunAuthor Commented:
Awesome, I am not a database guy. I like the web site www.datamodel.org, it has some really good articles. Thanks a lot AielloJ. I think I need to rethink some things. I'm just going to leave this open for a few more days to see what kind of response I get.

Many, many thanks.

RFR
0
 
AielloJCommented:
Getting the data model right should always be the first step.  The entities and their relationships to each other is independent of input form layout, programming/scripting languages, etc.  A good data model eliminates almost all, if not all, of the code to move and copy things around, etc, and is the best chance for your project to be a success.

It appears from your description you have at least 3 entities: Demographics, Employment, and Users.  What will probably replace your tokens is the ID column of the Users table.  The ID value is automatically generated for you when you insert the users data into the table, and it's guaranteed to be unique.  That concept eliminates the entire need to generate your own tokens via a function.

Hope to hear back in a few days.

JRA
0
 
RunForrestRunAuthor Commented:
Thanks AielloJ, you have been more than helpful.
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now