DaniWeb IT Discussion Community

DaniWeb IT Discussion Community (http://www.daniweb.com/forums/index.php)
-   VB.NET (http://www.daniweb.com/forums/forum58.html)
-   -   dropdown (http://www.daniweb.com/forums/thread201605.html)

arunasingh Jul 4th, 2009 4:32 am
dropdown
 
i have a problem in dropdown :suppose i select id from dropdown then i want name of the employee is displayed matched with that id is displayed in textbox : i have use the following code

con = New SqlConnection(constr)
adpt = New SqlDataAdapter("select * from reg where f_name='" + DropDownList1.SelectedItem.Text.ToString + "' ", con)
ds = New DataSet
adpt.Fill(ds)
If ds.Tables(0).Rows.Count - 1 >= 0 Then
TextBox1.Text = ds.Tables(0).Rows(0).Item(11)
End If

adatapost Jul 4th, 2009 6:30 am
Re: dropdown
 
arunasingh,

This is your 38th post and you post source code without bb code tags. I think you haven't read - How to use bb code tags?.

Wrap up source code with bb code tags.

babbu Jul 5th, 2009 6:52 am
Re: dropdown
 
the logic u r using is incorrect.
use a looping statement.
traverse each record of the data set using this loop.
inside the loop check for the matching id.
when its found u display that information in the text box and then u break out of the loop


All times are GMT -4. The time now is 10:36 pm.

Forum system based on vBulletin Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
©2003 - 2009 DaniWeb® LLC