0

我在 dbml 文件中有存储过程,我想做这样的事情

 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

但我有一个空引用异常。如何以正确的方式做到这一点?

GetAsDateList() 过程是

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

1 回答 1

1

你能不能

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

    cmbData.DataSource = dateList
    cmbData.DataBind()
End Sub
于 2009-01-12T14:07:30.767 回答