Solved

Multipage web app with multi SQL tables.

Posted on 2008-10-20
5
242 Views
Last Modified: 2012-05-05
.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
Comment
Question by:RunForrestRun
  • 3
  • 2
5 Comments
 
LVL 13

Expert Comment

by:AielloJ
ID: 22761074
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
 
LVL 13

Expert Comment

by:AielloJ
ID: 22761083
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
 

Author Comment

by:RunForrestRun
ID: 22768418
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
 
LVL 13

Accepted Solution

by:
AielloJ earned 500 total points
ID: 22768642
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
 

Author Closing Comment

by:RunForrestRun
ID: 31507925
Thanks AielloJ, you have been more than helpful.
0

Featured Post

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
Browsers only know CSS so your awesome SASS code needs to be translated into normal CSS. Here I'll try to explain what you should aim for in order to take full advantage of SASS.
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

743 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now