Solved

Multipage web app with multi SQL tables.

Posted on 2008-10-20
5
245 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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
List<PaisEntity> - show some 1 28
Create animated movies for web page 18 83
insert value of checklistbox checked 4 32
How to repeat the data 4 15
Preface This is the third article about the EE Collaborative Login Project. A Better Website Login System (http://www.experts-exchange.com/A_2902.html) introduces the Login System and shows how to implement a login page. The EE Collaborative Logi…
I found this questions asking how to do this in many different forums, so I will describe here how to implement a solution using PHP and AJAX. The logical flow for the problem should be: Write an event handler for the first drop down box to get …
The viewer will learn the benefit of using external CSS files and the relationship between class and ID selectors. Create your external css file by saving it as style.css then set up your style tags: (CODE) Reference the nav tag and set your prop…
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.

808 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