我有一些ADO.Net代碼,如下所示,它成功地在DB中執行SP,而它在tenantId中引發異常,請指導我。command.Parameters.GetValue無效的轉換異常<long>
command.Parameters.Input.BigInt(ParameterConstants.TenantId)
.BigInt(ParameterConstants.PartyId, tenant.PartyId)
.Varchar(ParameterConstants.TenantCode, tenant.TenantCode)
.BigInt(ParameterConstants.PharmaId, tenant.PharmaId)
.BigInt(ParameterConstants.UserId, userProfileId);
command.ExecuteNonQuery();
var tenantId = command.Parameters.GetValue<long>(ParameterConstants.TenantId);
在var tenantId
它拋出投例外System.InvalidCastExceptio
... 確切異常Specified cast is not valid.
An exception of type 'System.InvalidCastException' occurred in ...Data.dll but was not handled in user code
Additional information: Specified cast is not valid.
您能否向我們提供完整的例外信息? – andreasnico
我添加了確切的異常。 –
如果添加輸出參數,該怎麼辦? – alsafoo