Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Web Controls > multiple dropdown lists = multiple data readers???

Reply
Thread Tools

multiple dropdown lists = multiple data readers???

 
 
Andrew Kidd
Guest
Posts: n/a
 
      04-20-2004
Hi,

I've have a form for the user to fill in which comprises of 5 date ranges,
each made up of a "FROM" & "TO" date, which is built from a "[Month]"
dropdownlist & a "[Day]" dropdownlist, as follows:

Period 1 = FROM [Month][day] TO [Month][Day]
Period 2 = FROM [Month][day] TO [Month][Day]
Period 3 = FROM [Month][day] TO [Month][Day]
Period 4 = FROM [Month][day] TO [Month][Day]
Period 5 = FROM [Month][day] TO [Month][Day]

Ordinarily I use the following code to bind up a dropdownlist:

If IsPostBack = False Then
Dim objCn As New Odbc.OdbcConnection("DSN=IRS")
Dim objCmd As New Odbc.OdbcCommand("SELECT DISTINCT
tblHoliday.Country FROM tblHoliday", objCn)
Dim objDr As Odbc.OdbcDataReader

objCn.Open()
objDr = objCmd.ExecuteReader

Me.cboCountries.DataSource = objDr

Me.cboCountries.DataTextField = "Country"
Me.cboCountries.DataValueField = "Country"
Me.cboCountries.DataBind()
objDr.Close()
objCn.Close()

End If

I've got the months and days each in a separate lookup table, but I'm faced
with the prospect of having to run the above routine 10 times each for both
the days and months in order to populate the combos.

Is there an easier way to do this?

Thanks in advance

Andy


 
Reply With Quote
 
 
 
 
Andrew Kidd
Guest
Posts: n/a
 
      04-21-2004
Doh!

Sussed it.

"Andrew Kidd" <> wrote in message
news:...
> Hi,
>
> I've have a form for the user to fill in which comprises of 5 date ranges,
> each made up of a "FROM" & "TO" date, which is built from a "[Month]"
> dropdownlist & a "[Day]" dropdownlist, as follows:
>
> Period 1 = FROM [Month][day] TO [Month][Day]
> Period 2 = FROM [Month][day] TO [Month][Day]
> Period 3 = FROM [Month][day] TO [Month][Day]
> Period 4 = FROM [Month][day] TO [Month][Day]
> Period 5 = FROM [Month][day] TO [Month][Day]
>
> Ordinarily I use the following code to bind up a dropdownlist:
>
> If IsPostBack = False Then
> Dim objCn As New Odbc.OdbcConnection("DSN=IRS")
> Dim objCmd As New Odbc.OdbcCommand("SELECT DISTINCT
> tblHoliday.Country FROM tblHoliday", objCn)
> Dim objDr As Odbc.OdbcDataReader
>
> objCn.Open()
> objDr = objCmd.ExecuteReader
>
> Me.cboCountries.DataSource = objDr
>
> Me.cboCountries.DataTextField = "Country"
> Me.cboCountries.DataValueField = "Country"
> Me.cboCountries.DataBind()
> objDr.Close()
> objCn.Close()
>
> End If
>
> I've got the months and days each in a separate lookup table, but I'm

faced
> with the prospect of having to run the above routine 10 times each for

both
> the days and months in order to populate the combos.
>
> Is there an easier way to do this?
>
> Thanks in advance
>
> Andy
>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
1 Gridview. Dropdown A is column from database, Dropdown B is column from database, Data in A and B must be from same row. anonymoushamster@gmail.com ASP .Net 2 11-07-2007 12:40 PM
Creating Multiple Dropdown lists and populating them enstn85 ASP .Net 0 06-20-2006 10:37 PM
List of lists of lists of lists... =?UTF-8?B?w4FuZ2VsIEd1dGnDqXJyZXogUm9kcsOtZ3Vleg==?= Python 5 05-15-2006 11:47 AM
multiple dropdown lists = multiple data readers??? Andrew Kidd ASP .Net 3 04-22-2004 03:23 PM
Sorting data in Listbox/Dropdown lists Sriram ASP .Net 2 06-27-2003 02:11 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57