473,322 Members | 1,409 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

Database Table Verses DropDownList

What is the best way to store small sets of look-up data for my web
application in the database (sql2000) or in a dropdownlist control in my web
form?
Or is it a question of how much data I want to type over and over again.

Example:
TableName - YearMonths
MonthID (1, 2, 3, 4, etc)
YearMonth (Jan, Feb, Mar, Apr, etc)

TableName - Gender
GenderID (M, F)
Description (Male, Female)

TableName - MonthDate
MonthDate (1, 2, 3, 4,......31)

Note: All Interaction with the database is done from the web Interface.

Thanks!

Nov 18 '05 #1
4 1038
I'm not 100% sure what you are asking, but I think the answer is to make
liberal use of the cache:

public sealed class LookupUtility{
private LookupUtility(){}

public static DataTable GetYears(){
string cacheKey = "getYears";
DataTable dt = (DataTable)HttpRuntime.Cache[cacheKey];
if (dt == null){
dt = getFromDataBase();
HttpRuntime.Cache.Insert(cacheKey, dt, null, DateTime.MaxValue,
TimeSpan.Zero);
}
return dt;
}
}
things you might want to consider is to create a lookup class and a
lookupcollection so you aren't passing around weakly-typed datatables
around...and do you really need to hit the database to get the YearMonth and
MonthDate? .Net has built-in capabilities for that...
Karl
--
MY ASP.Net tutorials
http://www.openmymind.net/
"Leon" <vn*****@msn.com> wrote in message
news:%2******************@TK2MSFTNGP14.phx.gbl...
What is the best way to store small sets of look-up data for my web
application in the database (sql2000) or in a dropdownlist control in my web form?
Or is it a question of how much data I want to type over and over again.

Example:
TableName - YearMonths
MonthID (1, 2, 3, 4, etc)
YearMonth (Jan, Feb, Mar, Apr, etc)

TableName - Gender
GenderID (M, F)
Description (Male, Female)

TableName - MonthDate
MonthDate (1, 2, 3, 4,......31)

Note: All Interaction with the database is done from the web Interface.

Thanks!

Nov 18 '05 #2
This is what I'm asking:

do I really need to hit the database to get the YearMonth and
MonthDate? What .Net built-in capabilities do the following...

"Karl Seguin" <karl REMOVE @ REMOVE openmymind REMOVEMETOO . ANDME net>
wrote in message news:OU****************@TK2MSFTNGP10.phx.gbl...
I'm not 100% sure what you are asking, but I think the answer is to make
liberal use of the cache:

public sealed class LookupUtility{
private LookupUtility(){}

public static DataTable GetYears(){
string cacheKey = "getYears";
DataTable dt = (DataTable)HttpRuntime.Cache[cacheKey];
if (dt == null){
dt = getFromDataBase();
HttpRuntime.Cache.Insert(cacheKey, dt, null, DateTime.MaxValue,
TimeSpan.Zero);
}
return dt;
}
}
things you might want to consider is to create a lookup class and a
lookupcollection so you aren't passing around weakly-typed datatables
around...and do you really need to hit the database to get the YearMonth
and
MonthDate? .Net has built-in capabilities for that...
Karl
--
MY ASP.Net tutorials
http://www.openmymind.net/
"Leon" <vn*****@msn.com> wrote in message
news:%2******************@TK2MSFTNGP14.phx.gbl...
What is the best way to store small sets of look-up data for my web
application in the database (sql2000) or in a dropdownlist control in my

web
form?
Or is it a question of how much data I want to type over and over again.

Example:
TableName - YearMonths
MonthID (1, 2, 3, 4, etc)
YearMonth (Jan, Feb, Mar, Apr, etc)

TableName - Gender
GenderID (M, F)
Description (Male, Female)

TableName - MonthDate
MonthDate (1, 2, 3, 4,......31)

Note: All Interaction with the database is done from the web Interface.

Thanks!


Nov 18 '05 #3
Well, you can do things like:

DateTime start = new DateTime(2000,1,1);
for (int i = 0; i < 12; ++i) {
Response.Write(String.Format("{0:MMMM}", start.AddMonths(i)));
}

The main reason I like it better is that it'll automatically display the
month name in the culture you have it set..so if you switch the culture to
fr-CA, it'll automatically display "janvier", "fevrier" ... and so on
Karl

--
MY ASP.Net tutorials
http://www.openmymind.net/
"Leon" <vn*****@msn.com> wrote in message
news:Oh**************@tk2msftngp13.phx.gbl...
This is what I'm asking:

do I really need to hit the database to get the YearMonth and
MonthDate? What .Net built-in capabilities do the following...

"Karl Seguin" <karl REMOVE @ REMOVE openmymind REMOVEMETOO . ANDME net>
wrote in message news:OU****************@TK2MSFTNGP10.phx.gbl...
I'm not 100% sure what you are asking, but I think the answer is to make
liberal use of the cache:

public sealed class LookupUtility{
private LookupUtility(){}

public static DataTable GetYears(){
string cacheKey = "getYears";
DataTable dt = (DataTable)HttpRuntime.Cache[cacheKey];
if (dt == null){
dt = getFromDataBase();
HttpRuntime.Cache.Insert(cacheKey, dt, null, DateTime.MaxValue,
TimeSpan.Zero);
}
return dt;
}
}
things you might want to consider is to create a lookup class and a
lookupcollection so you aren't passing around weakly-typed datatables
around...and do you really need to hit the database to get the YearMonth
and
MonthDate? .Net has built-in capabilities for that...
Karl
--
MY ASP.Net tutorials
http://www.openmymind.net/
"Leon" <vn*****@msn.com> wrote in message
news:%2******************@TK2MSFTNGP14.phx.gbl...
What is the best way to store small sets of look-up data for my web
application in the database (sql2000) or in a dropdownlist control in my
web
form?
Or is it a question of how much data I want to type over and over

again.
Example:
TableName - YearMonths
MonthID (1, 2, 3, 4, etc)
YearMonth (Jan, Feb, Mar, Apr, etc)

TableName - Gender
GenderID (M, F)
Description (Male, Female)

TableName - MonthDate
MonthDate (1, 2, 3, 4,......31)

Note: All Interaction with the database is done from the web Interface.

Thanks!



Nov 18 '05 #4
Thanks Karl!

"Karl Seguin" <karl REMOVE @ REMOVE openmymind REMOVEMETOO . ANDME net>
wrote in message news:Oj*************@TK2MSFTNGP12.phx.gbl...
Well, you can do things like:

DateTime start = new DateTime(2000,1,1);
for (int i = 0; i < 12; ++i) {
Response.Write(String.Format("{0:MMMM}", start.AddMonths(i)));
}

The main reason I like it better is that it'll automatically display the
month name in the culture you have it set..so if you switch the culture to
fr-CA, it'll automatically display "janvier", "fevrier" ... and so on
Karl

--
MY ASP.Net tutorials
http://www.openmymind.net/
"Leon" <vn*****@msn.com> wrote in message
news:Oh**************@tk2msftngp13.phx.gbl...
This is what I'm asking:

do I really need to hit the database to get the YearMonth and
MonthDate? What .Net built-in capabilities do the following...

"Karl Seguin" <karl REMOVE @ REMOVE openmymind REMOVEMETOO . ANDME net>
wrote in message news:OU****************@TK2MSFTNGP10.phx.gbl...
> I'm not 100% sure what you are asking, but I think the answer is to
> make
> liberal use of the cache:
>
> public sealed class LookupUtility{
> private LookupUtility(){}
>
> public static DataTable GetYears(){
> string cacheKey = "getYears";
> DataTable dt = (DataTable)HttpRuntime.Cache[cacheKey];
> if (dt == null){
> dt = getFromDataBase();
> HttpRuntime.Cache.Insert(cacheKey, dt, null, DateTime.MaxValue,
> TimeSpan.Zero);
> }
> return dt;
> }
> }
>
>
> things you might want to consider is to create a lookup class and a
> lookupcollection so you aren't passing around weakly-typed datatables
> around...and do you really need to hit the database to get the
> YearMonth
> and
> MonthDate? .Net has built-in capabilities for that...
>
>
> Karl
> --
> MY ASP.Net tutorials
> http://www.openmymind.net/
>
>
> "Leon" <vn*****@msn.com> wrote in message
> news:%2******************@TK2MSFTNGP14.phx.gbl...
>> What is the best way to store small sets of look-up data for my web
>> application in the database (sql2000) or in a dropdownlist control in my > web
>> form?
>> Or is it a question of how much data I want to type over and over again. >>
>> Example:
>> TableName - YearMonths
>> MonthID (1, 2, 3, 4, etc)
>> YearMonth (Jan, Feb, Mar, Apr, etc)
>>
>> TableName - Gender
>> GenderID (M, F)
>> Description (Male, Female)
>>
>> TableName - MonthDate
>> MonthDate (1, 2, 3, 4,......31)
>>
>> Note: All Interaction with the database is done from the web
>> Interface.
>>
>> Thanks!
>>
>>
>>
>
>



Nov 18 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Leon | last post by:
What is the best way to store small sets of look-up data for my web application in the database (sql2000) or in a dropdownlist control in my web form? Or is it a question of how much data I want...
4
by: beatdream | last post by:
I am designing a database to handle different kinds of products ... and these products can have different properties...for example, a trouser can be specified by the width, length, color, and other...
3
by: ak | last post by:
Q1: I am looking to find/build a table of PHP version verses timezonedb version shipped with it. For example, I think that 5.2.0 updated the timezonedb to the 2006.14 version. Is there a table of...
1
by: luvkling | last post by:
hi, i am new to asp.net. i currently doin a website. i created a add form in this form the user need to add in the record n when they press the submit button it will add the record into the access...
4
by: =?Utf-8?B?QmFyYmFyYSBBbGRlcnRvbg==?= | last post by:
I setup a simple gridview as a utility just to do some updates, nothing fancy just wanted easy UI to make updates. When I select ‘Edit’, I get the fields I want to edit. I edit them and click...
3
by: dlamarche | last post by:
Hello I am new to PHP and I am reading the book Build you own database driven website using PHP and MySQL. I am trying something on my own as an exercise from the book. I sucessfully created a...
0
by: lamolap | last post by:
i have 1 gridview , a dropdownlist inside a gridview and a commandfield of (edit, update and cancel) my gidview looks like this Edit Surname Initials ...
1
by: gomathinayagam | last post by:
hai, am only beginer in c#... i am trying to connect database with webform. using a technique that the fields of the table and the controls in a form are named same...then i try get the controls...
10
by: jmarcrum | last post by:
Hi everyone! I have a church database that keeps track of all of our church's members: first and last name, email address, phone number, home address (street, city, zipcode). I was...
1
by: asp beginner | last post by:
I am building an Eccomerce site and I am trying to make my shopping cart work. I am having a problem with when I have entered data into my form it is not submitting into my access database. This my...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.