population dropdown list from the database

emupnavyCaumn

New Member
In the database i have the following<BR>Mr<BR>Mrs<BR>Miss<BR>Male<BR>Female<BR>Yes<BR>No<BR>I want to populate these from the database to 3 dropdown list.<BR>Mr, Mrs, Miss in one dropdown list and Male and Female in another dropdown list and Yes, No in another dropdownlist.<BR><BR>Which is the best way to do this. Should I generate them as xml and bind them to each dropdown list? I dont have a clear and better idea of doing this. Any ideas please.Well I haven't played with .NET much but I personally thing that it is a waist of resources to create 3 dropdownlist especially when you won't have any other gender then "Male" and "Female" (well maybe in 2024 who knows!) and the same thing applies for "Yes" and "No" is your application eventually will have a "Maybe" or a "I'm not sure" ?<BR><BR>In any case, you should hardcode these 2 dropdownlist since they won't change every day or a least put the data into global variables or Const. But don't waist/make a connection just for that.<BR><BR>Well thats just me, and I don't have all the specs for your app so I can't really say anything else.<BR><BR>Hope this helps!the title is populating dropdownlist and not populationI do accept that I have to hardcode the Yes/No and Male/Female but I have shown them as an example because there are other datas that I have in the database which i want to populate to the dropdown list. For example i have a list of occupation types status: software, hardware, chef, cleaner etc. So I have plenty of things in the database which are generic and which might change for different type of users. I need to populate them to the dropdown list. I am worried about the performance as i will have more than 5 dropdown list which needs to be populated from the database. anymore ideas please.<BR>Well you wont have any performance lost because you create 5 dropdownlist in fact, now the notion of recordset, in .NET, is gone and it is now a datasheet (hope I remeber right :)).<BR><BR>What you can do, I guess, is build 5 different SQL Queries but I think that this will defeat the purpose of the datasheet and might create some performance lost but how much...that I really don't know, so just create one SQL Query, then play around with the results building your 5 dropdownlist.<BR><BR>Like I said, I haven't played with .NET much so I can't really give you an example :(<BR><BR>And I can't confirm that what I say is the truth, I'm only assuming that it is this way.
 
Back
Top