?
Solved

Multipage web app with multi SQL tables.

Posted on 2008-10-20
5
Medium Priority
?
251 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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 2000 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

Why Off-Site Backups Are The Only Way To Go

You are probably backing up your data—but how and where? Ransomware is on the rise and there are variants that specifically target backups. Read on to discover why off-site is the way to go.

Question has a verified solution.

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

Styling your websites can become very complex. Here I'll show how SASS can help you better organize, maintain and reuse your CSS code.
Have you tried to learn about Unicode, UTF-8, and multibyte text encoding and all the articles are just too "academic" or too technical? This article aims to make the whole topic easy for just about anyone to understand.
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…
The viewer will the learn the benefit of plain text editors and code an HTML5 based template for use in further tutorials.
Suggested Courses

762 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