需要帮助。
当我没有在课程中分配任何属性时,我发现这个错误很奇怪。以下是我的源代码。
Public Function GenerateNonContainerReport(ByVal dateFrom As Date, ByVal dateTo As Date, ByVal userID As String) As rptNonContainerized
Try
Dim dtNonContainer As New dsPrint.dtNonContainerDataTable
Dim strSQL As String = "EXEC dbo.sp_RetrieveNonContainerizedRev @StartDate=" + dateFrom + ", @EndDate=" + dateTo + ", @UserID=" + userID
myConnectionSettings = New ConnectionStringSettings("SQLConnection", strConn, "System.Data.SqlClient")
myProvider = DbProviderFactories.GetFactory(myConnectionSettings.ProviderName)
db = New GenericDatabase(myConnectionSettings.ConnectionString, myProvider)
dbCommand = db.GetSqlStringCommand(strSQL)
Dim dTable = db.ExecuteDataSet(dbCommand).Tables(0) ' error occurs here
Catch ex As Exception
Return Nothing
End Try
End Sub
应用程序正在使用存储数据表的xsd文件。此外,此存储过程接受3个参数。是否可能在此处发生错误?
最新更新 我收到此错误“对象引用未设置为对象的实例。”我现在想知道代码中我没有实例化的地方。
答案 0 :(得分:0)
检查DataSet是否已返回表
dataSet = db.ExecuteDataSet(dbCommand) 'Break here and inspect the object
查找dataSet.Tables
此外,