07-09-18, 12:22 PM
كود :
DropDownList2.DataBind()
DropDownList2.Items.Clear()
Dim cmd0 As New SqlCommand
Dim dr0 As SqlDataReader
If con.State = ConnectionState.Open Then con.Close()
con.Open()
cmd0.Connection = con
cmd0.CommandType = CommandType.Text
cmd0.CommandText = "SELECT * FROM Categories order by CategorieName;"
dr0 = cmd0.ExecuteReader
Do While dr0.Read
If dr0.Item("CategorieName").ToString <> "" Then
If DropDownList2.Items.Contains(dr0.Item("CategorieName")) Then
Else
DropDownList2.Items.Add(dr0.Item("CategorieName"))
End If
End If
Loop
dr0.Close()
con.Close()
