Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 6 of 6
  1. #1
    New to the CF scene
    Join Date
    Feb 2013
    Posts
    7
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Database-driven Website question

    Hey guys. I'm new to database programming, been reading books lately and have created several desktop applications. I am creating a website in ASP.NET(C#). I want(I think I want) this website to be database-driven as it will hold tons of user information.

    Without explaining too many details of my idea for the website I will explain one part of it in enough detail so you guys can understand my questions.

    I have one database file that contains MANY tables but the ones to note are the following tables:
    "Users"
    "NFLWeek1"
    "NFLWeek1UserPicks"

    The "Users" table contains all the users' information. Column one being "User_ID"(Primary key)

    "NFLWeek1" lists all(16) games in week 1(row 1 being game 1, row 2 being game 2, etc) - the columns for this table include; team1name, team2name, team1score, team2score, winner, etc.

    "NFLWeek1UserPicks" list all the users' picks for each game in that week. Each row being a different user. Columns for this table include; User_ID(foreign key), Winnergame1, game1wage, and several other columns pertaining to game1, THEN Winnergame2, game2wage, etc. etc.... which means this one table is 96 columns wide! That's for only 16 NFL games in a week. If I did the same for MLB, having roughly 100 games a week, my "MLBWeek1UserPicks" table will be roughly 600 columns wide!!

    So here's my question(assuming I haven't bored you yet)... Am I going about this the wrong way??? Would there be a better way of saving this user information??? It just seems to me that this is a clumsy way of storing this information. But I don't have enough database experience to know. Thanks for any input on this guys!! Cheers!

  • #2
    Senior Coder alykins's Avatar
    Join Date
    Apr 2011
    Posts
    1,925
    Thanks
    46
    Thanked 203 Times in 202 Posts
    You should look at the built in framework login contro. it will require you to create a separate DB for user's and what not. this will give you a layer of separation and more finite control over login access. Then for your other stuff, yes have it all in one database. The database design is up to you, everyone has their own way of doing it and I've seen well experienced DBA's create them in different fashions. Without knowing all the 'tid-bits' of your database, it will be hard to construct. You will find yourself potentially restructuring your database many times, because even you, with all the knowledge of what you want, will not get it right the first time; no one does. That is why code is changed and updated.

    As far as setting up the database and all that fun stuff you are better off choosing a database, and then requesting help there. While you may be doing an asp.net application, it has nothing to do with the database. From the .net side all you will care about is how to connect, and populate and all the other CRUD stuff.

    I code C hash-tag .Net
    Reference: W3C W3CWiki .Net Lib
    Validate: html CSS
    Debug: Chrome FireFox IE

  • #3
    Supreme Master coder! Old Pedant's Avatar
    Join Date
    Feb 2009
    Posts
    27,554
    Thanks
    80
    Thanked 4,620 Times in 4,583 Posts
    Code:
    it will require you to create a separate DB for user's and what not. this will give you a layer of separation and more finite control over login access. Then for your other stuff, yes have it all in one database.
    This is actually a poor design, if you are looking for referential integrity.

    That is, and for example only, if you don't want to able to delete a given user if there are any record s in other tables that are referencing his user id.

    At a minimum, I'd want the two TABLES in the same database, so I can make cross table references easily.
    An optimist sees the glass as half full.
    A pessimist sees the glass as half empty.
    A realist drinks it no matter how much there is.

  • #4
    Senior Coder alykins's Avatar
    Join Date
    Apr 2011
    Posts
    1,925
    Thanks
    46
    Thanked 203 Times in 202 Posts
    from my understanding though, with the asp.net login control - and built in security features- (you have to run a database configuration) it set's it up and makes it unable to use as a regular db then... I could be very wrong on this as I'm not a DBA- do you know?

    I code C hash-tag .Net
    Reference: W3C W3CWiki .Net Lib
    Validate: html CSS
    Debug: Chrome FireFox IE

  • #5
    Supreme Master coder! Old Pedant's Avatar
    Join Date
    Feb 2009
    Posts
    27,554
    Thanks
    80
    Thanked 4,620 Times in 4,583 Posts
    It's been a long time, but you *used* to be able to configure the login stuff so it would use your own database and table instead of creating a new one.

    Okay...good old google:
    https://www.google.com/search?q=asp....hrome&ie=UTF-8

    Yes, you can (and I think should) still do this.

    Looks like this is a good source of info:
    http://aspnet.4guysfromrolla.com/articles/040506-1.aspx
    An optimist sees the glass as half full.
    A pessimist sees the glass as half empty.
    A realist drinks it no matter how much there is.

  • #6
    Senior Coder alykins's Avatar
    Join Date
    Apr 2011
    Posts
    1,925
    Thanks
    46
    Thanked 203 Times in 202 Posts
    I like that second resource- I'll have to read through it sometime... So @OP... Everything I said, amended by what OldPedant said of keeping it one db

    I code C hash-tag .Net
    Reference: W3C W3CWiki .Net Lib
    Validate: html CSS
    Debug: Chrome FireFox IE


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •