logoncom
asked on
Combobox filled using datatable fails
I am trying to get a list of items to fill in a combobox.
I call a function and expect a return list.... what is wrong with my code?
I call a function and expect a return list.... what is wrong with my code?
cbbae.DataSource = employeelist("sales")
Public Shared Function employeelist(ByVal Dept As String)
Dim cbb As ComboBox = New ComboBox
Dim dt As DataTable = New DataTable
Using conn As New SqlConnection(myconnectionstring)
Using cmd As New SqlCommand("APP_GetEmployeeList", conn)
cmd.CommandType = CommandType.StoredProcedure
cmd.Parameters.AddWithValue("@department", Dept)
Using da As New SqlDataAdapter(cmd)
da.Fill(dt)
With cbb
.DataSource = dt
.DisplayMember = "repcode"
End With
End Using
End Using
End Using
Return cbb.DisplayMember
End Function
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER