Populating a dropdown with a list of members -
04-13-2004
, 05:02 PM
I am attempting to populate a dropdown list using the following VB .Net
code:
Dim ds As New DataSet
Dim myCon As New OleDbConnection("Provider=MSOLAP;Integrated
Security=SSPI;Persist Security Info=False;Data Source=dev-sdb-3;Initial
Catalog=HRAnalytics_Demo")
myCon.Open()
Dim sStr As String = "with Member [Measures].[GenderUniqueName] AS
'[Gender].currentmember.UniqueName'" & _
" member [Measures].[GenderDisplayName] as
'Space([Gender].Currentmember.Level.Ordinal * 4) +
Gender.Currentmember.Name'" & _
" SELECT {[Measures].[GenderUniqueName],[Measures].[GenderDisplayName]} on
AXIS(0), {Gender.members} on AXIS(1) " & _
" FROM [EEO Analysis for Candidates Attached to Reqs]"
Dim myDataAdapter As New OleDbDataAdapter(sStr, myCon)
myDataAdapter.Fill(ds)
dd1.DataSource = ds.Tables(0).DefaultView
dd1.DataBind()
What I end up with is four rows in the dropdown like I expect, but the text
"System.Data.DataRowView" instead of the actual data I expect.
If before the databind I add:
dd1.DataTextField = "GenderDisplayName"
dd1.DataValueField = "GenderUniqueName"
the databind then throws the following error:
DataBinder.Eval: 'System.Data.DataRowView' does not contain a property with
the name GenderDisplayName.
Any ideas what I am doing wrong? Is there perhaps something wrong with how I
am specifying "DataTextField" and "DataValueField"
Thanks in advance,
Bob |