M
Martin Feuersteiner
Dear Group
I've created a DataReader to populate a dropdown box.
It works fine until I would like to use the DataReader result to poulate a
second drop-down box on the same form
e.g. like this:
Dim str1 As String = "EXEC sp_MyDataReader"
Dim cmd1 As New SqlClient.SqlCommand(str1, SQLConnection)
Dim MyDataReader As SqlClient.SqlDataReader = cmd1.ExecuteReader()
SearchDrop1.DataSource = MyDataReader
SearchDrop1.DataTextField = "LabelTransactionDate"
SearchDrop1.DataValueField = "TransactionDate"
SearchDrop1.DataBind()
SearchDrop2.DataSource = MyDataReader
SearchDrop2.DataTextField = "LabelTransactionDate"
SearchDrop2.DataValueField = "TransactionDate"
SearchDrop2.DataBind()
MyDataReader.Close()
When executing this code, both drop-down boxes remain empty. Why? Any work
arounds?
Thanks for your time & efforts!
Martin
I've created a DataReader to populate a dropdown box.
It works fine until I would like to use the DataReader result to poulate a
second drop-down box on the same form
e.g. like this:
Dim str1 As String = "EXEC sp_MyDataReader"
Dim cmd1 As New SqlClient.SqlCommand(str1, SQLConnection)
Dim MyDataReader As SqlClient.SqlDataReader = cmd1.ExecuteReader()
SearchDrop1.DataSource = MyDataReader
SearchDrop1.DataTextField = "LabelTransactionDate"
SearchDrop1.DataValueField = "TransactionDate"
SearchDrop1.DataBind()
SearchDrop2.DataSource = MyDataReader
SearchDrop2.DataTextField = "LabelTransactionDate"
SearchDrop2.DataValueField = "TransactionDate"
SearchDrop2.DataBind()
MyDataReader.Close()
When executing this code, both drop-down boxes remain empty. Why? Any work
arounds?
Thanks for your time & efforts!
Martin