Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   ASP .Net Web Controls (http://www.velocityreviews.com/forums/f63-asp-net-web-controls.html)
-   -   multiple dropdown lists = multiple data readers??? (http://www.velocityreviews.com/forums/t773069-multiple-dropdown-lists-multiple-data-readers.html)

Andrew Kidd 04-20-2004 10:16 PM

multiple dropdown lists = multiple data readers???
 
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



Andrew Kidd 04-21-2004 10:36 AM

Re: multiple dropdown lists = multiple data readers???
 
Doh!

Sussed it.

"Andrew Kidd" <andrew@nospamtoday.com> wrote in message
news:OGl7BVyJEHA.428@TK2MSFTNGP11.phx.gbl...
> 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
>
>





All times are GMT. The time now is 04:44 AM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.