0

hi,
sorgu = New SqlCommand("SELECT name, surname, age FROM veriler WHERE name=@name", database)
sorgu.Parameters.AddWithValue("@name", DropDownList1.Text)

name surname and age are rows in one of columns. i cant add them into the DropDownList.

DropDownList2.DataSource = kisiler
DropDownList2.DataTextField = "name"
DropDownList2.DataTextField = "surname"
DropDownList2.DataTextField = "age"
DropDownList2.DataBind()

this line add only "age". i want it to add all.

thank you

2
Contributors
1
Reply
2
Views
11 Years
Discussion Span
Last Post by mojio
0

I guess ...

Dropdownlist could have only one text datafield.

Your sql command have 3 columns in one row not one column
name | surname | age

sorgu = New SqlCommand("SELECT name, surname, age FROM veriler WHERE name=@name", database)
DropDownList2.DataSource = kisiler
DropDownList2.DataTextField = "name"
DropDownList2.DataTextField = "surname"
DropDownList2.DataTextField = "age"
DropDownList2.DataBind()

first line you put the value in field name in datatextfield
second line you put the value in field surname in datatextfield
and the last you put the value in field age in datatextfield

so your field age show in dropdownlist

^^

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.