0

Hi,
I'm trying to bind a DropDownList in the code behind using the following code:

Dim DatabaseConnection As New SqlConnection(ConfigurationManager.ConnectionStrings("myServer").ConnectionString)
Dim selectCMD As String = “SELECT name, id FROM Clients WHERE name LIKE @name + ‘%’”
Dim selectCMD As New SqlCommand(selectSQL, DatabaseConnection)
selectCMD.Parameters.Add(New SqlParameter("@name", SqlDbType.VarChar))
selectCMD.Parameters("@name").Value = name

Dim adapter As New SqlDataAdapter
Dim dTable As New DataTable
adapter.SelectCommand = selectCMD
adapter.Fill(dTable)

ddl.DataSource = dTable
ddl.DataBind()

But the values that are being bound to the DDL are all = System.Data.DataRowView. Any ideas of what is wrong?

2
Contributors
2
Replies
3
Views
8 Years
Discussion Span
Last Post by Ana D.
0

Hi Adatapost,

Thanks a lot! Now it works perfectly! =)

This question has already been answered. 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.