Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 4 > BOOK: Beginning ASP.NET 4 : in C# and VB
Password Reminder
Register
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
BOOK: Beginning ASP.NET 4 : in C# and VB
This is the forum to discuss the Wrox book Beginning ASP.NET 4: in C# and VB by Imar Spaanjaars; ISBN: 9780470502211
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning ASP.NET 4 : in C# and VB section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developersí questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Display Modes
  #1 (permalink)  
Old January 22nd, 2012, 04:05 AM
Friend of Wrox
Points: 1,469, Level: 15
Points: 1,469, Level: 15 Points: 1,469, Level: 15 Points: 1,469, Level: 15
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Oct 2009
Posts: 341
Thanks: 14
Thanked 3 Times in 3 Posts
Smile Choosing appropriate data type

Hello Imar,

Although you have chosen int data type for all type of records, e.g. for Genre Id, you have chosen int data type. Which is not necessary for Genre record.

It makes the application development faster, but I still want to know that
Is it fine to choose int for any record?
Doesn't it take a little more processing time than tinyint, smallint?
Won't it waste database space unnecessarily?

Many thanks....
Reply With Quote
  #2 (permalink)  
Old January 22nd, 2012, 05:38 AM
Imar's Avatar
Wrox Author
Points: 71,804, Level: 100
Points: 71,804, Level: 100 Points: 71,804, Level: 100 Points: 71,804, Level: 100
Activity: 100%
Activity: 100% Activity: 100% Activity: 100%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,050
Thanks: 80
Thanked 1,581 Times in 1,558 Posts
Default

Hi there,

I prefer consistency over the optimal data type. That is, using ints everywhere makes your code a little easier to use. I doubt you'll be able to measure the performance difference between an int and a tinyint in an ASP.NET application.

But choose what works best for you; smaller datatypes indeed work for for tables like Genre.

Imar
__________________
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Follow me on Twitter

Author of Beginning ASP.NET 4.5 : in C# and VB, Beginning ASP.NET Web Pages with WebMatrix
and Beginning ASP.NET 4 : in C# and VB.
Did this post help you? Click the button below this post to show your appreciation!
Reply With Quote
  #3 (permalink)  
Old January 22nd, 2012, 06:09 AM
Friend of Wrox
Points: 1,469, Level: 15
Points: 1,469, Level: 15 Points: 1,469, Level: 15 Points: 1,469, Level: 15
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Oct 2009
Posts: 341
Thanks: 14
Thanked 3 Times in 3 Posts
Smile

Quote:
I prefer consistency
I too prefer and it is really headache to remember different data types all the time.

But what about space that the larger data type will take...
Reply With Quote
  #4 (permalink)  
Old January 22nd, 2012, 06:17 AM
Imar's Avatar
Wrox Author
Points: 71,804, Level: 100
Points: 71,804, Level: 100 Points: 71,804, Level: 100 Points: 71,804, Level: 100
Activity: 100%
Activity: 100% Activity: 100% Activity: 100%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,050
Thanks: 80
Thanked 1,581 Times in 1,558 Posts
Default

Again, that would typically not be an issue in most ASP.NET applications. An int versus the other types is 4 bytes versus 2 or 1. You do the math to calculate when that becomes a problem:

http://msdn.microsoft.com/en-us/libr...v=sql.80).aspx
http://www.amazon.com/Western-Digita...227379&sr=1-12

Cheers,

Imar
__________________
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Follow me on Twitter

Author of Beginning ASP.NET 4.5 : in C# and VB, Beginning ASP.NET Web Pages with WebMatrix
and Beginning ASP.NET 4 : in C# and VB.
Did this post help you? Click the button below this post to show your appreciation!
Reply With Quote
  #5 (permalink)  
Old January 22nd, 2012, 06:42 AM
Friend of Wrox
Points: 1,469, Level: 15
Points: 1,469, Level: 15 Points: 1,469, Level: 15 Points: 1,469, Level: 15
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Oct 2009
Posts: 341
Thanks: 14
Thanked 3 Times in 3 Posts
Smile

Thanks,

prior asking here I had asked the same here but they said for your data base life you should go for smallest data type.
(first 2 replies)

I was little confused so I ask here as I broadly follow your steps.

Why link to amazon???
Reply With Quote
  #6 (permalink)  
Old January 22nd, 2012, 06:47 AM
Imar's Avatar
Wrox Author
Points: 71,804, Level: 100
Points: 71,804, Level: 100 Points: 71,804, Level: 100 Points: 71,804, Level: 100
Activity: 100%
Activity: 100% Activity: 100% Activity: 100%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,050
Thanks: 80
Thanked 1,581 Times in 1,558 Posts
Default

>> but they said for your data base life you should go for smallest data type.

Yes, that's what you typically do, but as I said earlier, I prefer consistency over the smallest data type when size is not that relevant.

The link to Amazon is to show how cheap large hard drives are. Unless you're storing billions of records, the int versus tinyint is not, IMO, a relevant discussion on storage....

Imar
__________________
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Follow me on Twitter

Author of Beginning ASP.NET 4.5 : in C# and VB, Beginning ASP.NET Web Pages with WebMatrix
and Beginning ASP.NET 4 : in C# and VB.
Did this post help you? Click the button below this post to show your appreciation!
Reply With Quote
  #7 (permalink)  
Old January 22nd, 2012, 06:57 AM
Friend of Wrox
Points: 1,469, Level: 15
Points: 1,469, Level: 15 Points: 1,469, Level: 15 Points: 1,469, Level: 15
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Oct 2009
Posts: 341
Thanks: 14
Thanked 3 Times in 3 Posts
Smile

Ok fine, I will go to int.

Quote:
The link to Amazon is to show how cheap large hard drives are. Unless you're storing billions of records, the int versus tinyint is not, IMO, a relevant discussion on storage....
feel good to know that you too kid.

Thanks a lot
Reply With Quote
Reply


Thread Tools
Display Modes

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 Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
he conversion of a char data type to a datetime data type resulted in an out-of-range adamhw Classic ASP Basics 3 December 23rd, 2009 07:18 AM
I need help choosing the right book. lJohnl BOOK: Beginning JavaScript 3rd Ed. ISBN: 978-0-470-05151-1 2 September 6th, 2007 09:03 AM
choosing directories joconnor PHP How-To 0 August 11th, 2004 10:12 AM
Choosing a database rbmese Visual C++ 3 August 9th, 2004 09:19 AM
Data Type error but it is the correct type Mitch SQL Server 2000 2 March 19th, 2004 11:31 AM



All times are GMT -4. The time now is 03:32 PM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.