Go Back   CodingForums.com > :: Server side development > ASP.NET

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 02-08-2013, 09:44 PM   PM User | #1
Tchpowdog
New to the CF scene

 
Join Date: Feb 2013
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Tchpowdog is an unknown quantity at this point
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!
Tchpowdog is offline   Reply With Quote
Old 02-09-2013, 05:59 PM   PM User | #2
alykins
Senior Coder

 
alykins's Avatar
 
Join Date: Apr 2011
Posts: 1,608
Thanks: 37
Thanked 183 Times in 182 Posts
alykins will become famous soon enough
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
alykins is offline   Reply With Quote
Old 02-13-2013, 12:15 AM   PM User | #3
Old Pedant
Supreme Master coder!

 
Old Pedant's Avatar
 
Join Date: Feb 2009
Posts: 23,237
Thanks: 59
Thanked 3,998 Times in 3,967 Posts
Old Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to all
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.
Old Pedant is offline   Reply With Quote
Old 02-13-2013, 01:58 PM   PM User | #4
alykins
Senior Coder

 
alykins's Avatar
 
Join Date: Apr 2011
Posts: 1,608
Thanks: 37
Thanked 183 Times in 182 Posts
alykins will become famous soon enough
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
alykins is offline   Reply With Quote
Old 02-13-2013, 08:40 PM   PM User | #5
Old Pedant
Supreme Master coder!

 
Old Pedant's Avatar
 
Join Date: Feb 2009
Posts: 23,237
Thanks: 59
Thanked 3,998 Times in 3,967 Posts
Old Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to all
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.
Old Pedant is offline   Reply With Quote
Old 02-13-2013, 08:57 PM   PM User | #6
alykins
Senior Coder

 
alykins's Avatar
 
Join Date: Apr 2011
Posts: 1,608
Thanks: 37
Thanked 183 Times in 182 Posts
alykins will become famous soon enough
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
alykins is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 12:23 PM.


Advertisement
Log in to turn off these ads.