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

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

^^

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.