我在 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