views:

633

answers:

1

I have stored procedure in dbml file, I want do smth like this

 Private Sub GetData()
    Dim dal = New DataAccess
    Dim dateList = dal.context.GetAsDateList()
    Dim enumerator As IEnumerator = dateList.GetEnumerator()

    While enumerator.MoveNext()
      cmbDate.Items.Add(enumerator.Current)
    End While
  End Sub

But I have a Null reference exception. How do this in a correct way?

The GetAsDateList() Procedure is

BEGIN
 SET NOCOUNT ON
 SELECT DISTINCT YEAR(TRADE_DATE) AS [Year], MONTH(TRADE_DATE) AS [Month] FROM MyTable
 RETURN
END
+1  A: 

can you just

Private Sub GetData()
    Dim dal = New DataAccess
    Dim dateList = dal.context.GetAsDateList()

    cmbData.DataSource = dateList
    cmbData.DataBind()
End Sub
John Boker