I am sure I am missing something simple here.
I have created a function to call a storeproc and want to return the results to a listbox:
If I use a radgrid the grid populates correctly but if I use a listbox the funtion only returns system.data.datarowview.
Can some one please set me straight.
Thank you.
I have created a function to call a storeproc and want to return the results to a listbox:
Protected
Sub
Page_Load(sender
As
Object
, e
As
System.EventArgs)
Handles
Me
.Load
rgd_CurrentGroups.DataSource = GetGroups()
rgd_CurrentGroups.DataBind()
RadListBox1.DataSource = GetGroups().DefaultView
RadListBox1.DataBind()
End
Sub
Private
Function
GetGroups()
As
DataTable
'Dim UserName As String = Request.QueryString("UserName")
Dim
UserName
As
String
=
"fred"
Dim
connectionString
As
String
=
DirectCast
(ConfigurationManager.ConnectionStrings(
"IT_CentralConnectionString"
).ConnectionString,
String
)
Dim
connection
As
New
SqlConnection(connectionString)
Dim
command
As
New
SqlCommand(connectionString, connection)
command =
New
SqlCommand(
"procGetGroupUsers"
, connection)
command.CommandType = CommandType.StoredProcedure
command.Parameters.Add(
"@UserName"
, SqlDbType.VarChar).Value = UserName
command.Connection.Open()
Dim
myDataAdapter
As
New
SqlDataAdapter(command)
Dim
myDataSet
As
New
DataSet
Dim
dtData
As
New
DataTable
myDataAdapter.Fill(myDataSet)
Return
myDataSet.Tables(0)
command.Connection.Close()
End
Function
If I use a radgrid the grid populates correctly but if I use a listbox the funtion only returns system.data.datarowview.
Can some one please set me straight.
Thank you.