|
 |
aspx_beginners thread: You can't get a simpler query
Message #1 by "Mrinal Srivastava" <mrinal.srivastava@p...> on Wed, 28 Aug 2002 12:42:58 +0530
|
|
Hi,
Thanks for having a newsgroups for beginners.
:-)
I need to display the results of a simple SQL Query in a ListBox. My query
is just returning one column and I want to populate a multiple-selection
listbox with it. Below is the code I'm attempting. But it's displaying
"System.Data.DataRowView" instead of actual skill names in the listbox. Any
poiters as to what I'm missing out?
Thanks in advance. A quick response is badly needed
Regards
Mrinal
strSql = "select skillName from Skills"
Dim sqlDA As New System.Data.SqlClient.SqlDataAdapter(strSql,
SqlConnection1)
Dim DS As System.Data.DataSet = New System.Data.DataSet()
sqlDA.Fill(DS, "Skills")
LstSkills.DataSource = DS.Tables("Skills").DefaultView
DataBind()
Message #2 by "John Ritchie" <jcriv@a...> on Fri, 30 Aug 2002 15:46:45
|
|
> Hi, well at the very least I think the last statement below shoild be
LstSkills.DataBind()
also you should be able to get away with
LstSkills.DataSource = DS
since by default it should use table(0)
Hope this helps.
John Ritchie
Hi,
Thanks for having a newsgroups for beginners.
:-)
I need to display the results of a simple SQL Query in a ListBox. My query
is just returning one column and I want to populate a multiple-selection
listbox with it. Below is the code I'm attempting. But it's displaying
"System.Data.DataRowView" instead of actual skill names in the listbox. Any
poiters as to what I'm missing out?
Thanks in advance. A quick response is badly needed
Regards
Mrinal
strSql = "select skillName from Skills"
Dim sqlDA As New System.Data.SqlClient.SqlDataAdapter(strSql,
SqlConnection1)
Dim DS As System.Data.DataSet = New System.Data.DataSet()
sqlDA.Fill(DS, "Skills")
LstSkills.DataSource = DS.Tables("Skills").DefaultView
DataBind()
|
|
 |