我在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
但我有一个Null引用异常。这是怎么做到的?
GetAsDateList()过程是
BEGIN
SET NOCOUNT ON
SELECT DISTINCT YEAR(TRADE_DATE) AS [Year], MONTH(TRADE_DATE) AS [Month] FROM MyTable
RETURN
END
答案 0 :(得分:1)
Private Sub GetData()
Dim dal = New DataAccess
Dim dateList = dal.context.GetAsDateList()
cmbData.DataSource = dateList
cmbData.DataBind()
End Sub