G
gurvar
Hi,
I'm trying to populate a list box with items from a db based
on selection from a combo id.
If there are 2 elements, the 1st is getting left out
If there are 4 elements, teh 1st is getting left out
Thanks in advance,
Following is the code:
Try
'Response.Write(strSQlQuery)
'Get a new datareader from our command
myDatareader = myCommand.ExecuteReader(CommandBehavior.CloseConnection)
'we've got our data ...now connect it to our list:
If myDatareader.Read = True Then
ListBox1.DataSource = myDatareader
ListBox1.DataValueField = "Unselected_Task_ID"
ListBox1.DataTextField = "Unselected_List_VC"
ListBox1.DataBind()
myDatareader.Close()
myConnection.Close()
' Next myDatareader
Else
ListBox1.Items.Insert(0, "---No Data---")
End If
Catch myException As Exception
Response.Write("An error has occured: " & myException.ToString())
'Finally
' If Not myDatareader Is Nothing Then
' End If
End Try
I'm trying to populate a list box with items from a db based
on selection from a combo id.
If there are 2 elements, the 1st is getting left out
If there are 4 elements, teh 1st is getting left out
Thanks in advance,
Following is the code:
Try
'Response.Write(strSQlQuery)
'Get a new datareader from our command
myDatareader = myCommand.ExecuteReader(CommandBehavior.CloseConnection)
'we've got our data ...now connect it to our list:
If myDatareader.Read = True Then
ListBox1.DataSource = myDatareader
ListBox1.DataValueField = "Unselected_Task_ID"
ListBox1.DataTextField = "Unselected_List_VC"
ListBox1.DataBind()
myDatareader.Close()
myConnection.Close()
' Next myDatareader
Else
ListBox1.Items.Insert(0, "---No Data---")
End If
Catch myException As Exception
Response.Write("An error has occured: " & myException.ToString())
'Finally
' If Not myDatareader Is Nothing Then
' End If
End Try