我遇到错误“System.ArgumentException:该值不能为空、字符串或空。”
在线路代码处
Public Sub New(ByVal databaseName As String)
**db = New Database(databaseName)**
End Sub
导致源文件为“C:\Company\Main\Source\DataLayer\Object2.vb”的错误请找到屏幕截图。
请问你能帮忙吗?
任务说明
我正在尝试从上述根文件的以下函数中执行“db_StoredProcedue”。C:\Company\Main\Source\Project\App_Code\Application\ResultDataset.vb
Imports System.Web.UI
Imports System.Data
Imports System.IO
Imports Company.Web.TMSuite.Workflow
Namespace Company.Web.TMSuite
Public Class ResultDataset
Inherits BasePage
Public Shared Function GetResultsDataset() As DataSet
Dim Obj1 As New Workflow(BasePage.DatabaseName)
Dim ds As New DataSet
ds = Obj1.GetResultDataset()
Return ds
End Function
End Class
End Namespace
Obj1 文件位于 C:\Company\Main\Source\Workflow\Object1.vb
Imports System.Globalization
Imports Company.Web.TMSuite.DataAccess
Imports Company.Web.TMSuite.TMSuiteComponents
Public Class Workflow
Private objResultsData As ResultsData
Public Sub New(ByVal databaseName As String)
objMetricsData = New MetricsData(databaseName)
End Sub
Public Function Obj2() As DataSet
Return objResultssData.Obj2()
End Function
End Class
Obj2 文件位于 C:\Company\Main\Source\DataLayer\Object2.vb
Imports Microsoft.VisualBasic
Imports System
Imports System.Data
Imports System.Configuration
Imports System.Globalization
Imports System.Web
Imports System.Data.Common
Imports Company.FoundationLibrary.Data
Imports Company.FoundationLibrary.ExceptionHandling
Imports Company.Web.TMSuite.DataAccess.ExceptionPolicies
Imports System.Data.SqlClient
Public Class ResultsData
Inherits BaseData
Public Sub New(ByVal databaseName As String)
db = New Database(databaseName) //Error Throughing at this line as -> ""System.ArgumentException: The value can not be null or string or empty.""
End Sub
Public Function Obj2() As DataSet
Dim errorMessage As String = Nothing
Dim ds As New DataSet
Dim cmd As DbCommand
ds.Locale = CultureInfo.InvariantCulture
Try
cmd = db.GetStoredProcCommand("db_StoredProcedue")
db.AddOutParameter(cmd, "@pErrorMessage", DbType.String, ErrorMessageSize)
ds = db.ExecuteDataSet(cmd)
If Not IsDBNull(db.GetParameterValue(cmd, "@pErrorMessage")) Then
errorMessage = db.GetParameterValue(cmd, "@pErrorMessage")
End If
Catch ex As Exception
Dim blnRethrow As Boolean = ExceptionPolicy.HandleException(ex, DataAccessExceptionPolicy)
If blnRethrow Then
Throw
End If
End Try
Return ds
End Function
End Class
请让我知道,如果我必须发布额外的代码来解决这个问题。