D
Darrel
This is a followup to a previous question. I'm trying to grab some data and
bind it to two different dropdown lists. (same data in each one).
I can't seem to populate them both without resorting to what looks like two
separate queries:
Dim objConnect As New OleDb.OleDbConnection(strConnect)
objConnect.Open()
Dim objCommand As New System.Data.OleDb.OleDbCommand(strSQL, objConnect)
DropDownList_category1.DataSource = objCommand.ExecuteReader()
DropDownList_category1.DataTextField = "directoryCategoryName"
DropDownList_category1.DataValueField = "directoryCategoryID"
DropDownList_category1.DataBind()
objCommand.Dispose
Dim objConnect2 As New OleDb.OleDbConnection(strConnect)
objConnect2.Open()
Dim objCommand2 As New System.Data.OleDb.OleDbCommand(strSQL, objConnect2)
DropDownList_category2.DataSource = objCommand2.ExecuteReader()
DropDownList_category2.DataTextField = "directoryCategoryName"
DropDownList_category2.DataValueField = "directoryCategoryID"
DropDownList_category2.DataBind()
objCommand2.Dispose
objConnect.Close()
Is that, indeed, two separate trips to the DB? If so, is there a way to
write that so I'm only grabbing the data once? If I just use one connection
and one command, only the first DDL gets populated.
-Darrel
bind it to two different dropdown lists. (same data in each one).
I can't seem to populate them both without resorting to what looks like two
separate queries:
Dim objConnect As New OleDb.OleDbConnection(strConnect)
objConnect.Open()
Dim objCommand As New System.Data.OleDb.OleDbCommand(strSQL, objConnect)
DropDownList_category1.DataSource = objCommand.ExecuteReader()
DropDownList_category1.DataTextField = "directoryCategoryName"
DropDownList_category1.DataValueField = "directoryCategoryID"
DropDownList_category1.DataBind()
objCommand.Dispose
Dim objConnect2 As New OleDb.OleDbConnection(strConnect)
objConnect2.Open()
Dim objCommand2 As New System.Data.OleDb.OleDbCommand(strSQL, objConnect2)
DropDownList_category2.DataSource = objCommand2.ExecuteReader()
DropDownList_category2.DataTextField = "directoryCategoryName"
DropDownList_category2.DataValueField = "directoryCategoryID"
DropDownList_category2.DataBind()
objCommand2.Dispose
objConnect.Close()
Is that, indeed, two separate trips to the DB? If so, is there a way to
write that so I'm only grabbing the data once? If I just use one connection
and one command, only the first DDL gets populated.
-Darrel