我有几个问题与将多个值传递给存储过程的参数之一以及返回转换为数据集以便将其绑定到 MS ReportViewer 的结果有关。
我收到的错误表明阅读器已关闭。
我的相关代码片段是:
Dim _listOfSites As New StringBuilder()
Dim _resultDataSet As DataSet = New DataSet
Using _conn as New SqlConnection()
_conn.ConnectionString = _connString
Try
For i as Integer = 0 To _sites.Count - 1
_listOfSites.Append(_sites(i))
If _sites.Count > 1 Then
_listOfSites.Append(",")
End If
Next
_conn.Open()
Dim _sqlCommand as SqlCommand = New SqlCommand("GetResults", _conn)
_sqlCommand.Parameters.Add("@Sites", SqlDbType.Varchar).Value = _listOfSites
_sqlCommand.Parameters.Add("@Date", SqlDbType.Date).Value = _date
Dim _reader as SqlDataReader = _sqlCommand.ExecuteReader
While _reader.Read
_resultDataSet.Load(_reader, LoadOption.PreserveChanges, New String() {"RegionalResults"})
End While
_reader.Close()
有人可以帮忙吗?
谢谢