Click here to Skip to main content
15,877,675 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hai friends,
am write code am selected weekly value in dropdownlist, then the weekly column display in the list box
but am can't find how to do
Protected Sub ddl_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles ddl.SelectedIndexChanged
Dim con As New SqlConnection("Data Source=.\SQLEXPRESS;initial catalog=workdb;persist Security info =true;user id=sa;password=vectra")
Dim da As New SqlDataAdapter("select weekly from table1 ", con)
Dim ds As New DataSet()
da.Fill(ds, "d")

If ds.Tables(0).Rows.Count > 0 Then
ListBox1.DataSource = ds.Tables(0)
End If
End Sub
Updated 4-Dec-11 19:45pm
[no name] 5-Dec-11 1:46am    
EDIT: added "pre" tag 5-Dec-11 2:01am    
Be more specific .....
D K N T H 5-Dec-11 2:39am    
what error did you got?

1 solution

i don't know what problem you are getiing.

First Correct your query I fyou want only selected week records..

"select weekly from table1 where weekly= dd1.selectedValue"

And if The check autoPostBack true property of the dropDown If on selected index control not going to this code.
Share this answer

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900