Salve ricevo il seguente messaggio di errore, ma non riesco a venirne a capo.Mi potreste dare una mano?
Message:
---------------------
Riferimento a un oggetto non impostato su un'istanza di oggetto.
Source:
---------------------
App_Code.rgcayws2
StackTrace:
---------------------
in modCast.cStrNullSP(Object oIn) in G:\webtaxus\Inetpub\TaxusNetV2\App_Code\modCast.vb:riga 146
in clsVisure.memReportImpresa(Object oResp, String sCribisToken, Object nIDCliente, Int32 nTipoDoc, String& sKey, String sInputRea, String sInputProv) in G:\webtaxus\Inetpub\TaxusNetV2\App_Code\clsVisure.vb:riga 3601
Invio il codice
Public Function memReportImpresa(ByVal oResp As Object, ByVal sCribisToken As String, ByVal nIDCliente As Object, ByVal nTipoDoc As Integer, ByRef sKey As String, ByVal sInputRea As String, ByVal sInputProv As String) As Boolean
Dim sAppo As String = ""
Dim oConn As SqlConnection = Nothing
Dim oCmd As SqlClient.SqlCommand
Dim sCmdText As String
Dim oParam As SqlClient.SqlParameter
Dim nIdOutput As Long = 0
Dim sDescrErrore As String = ""
memReportImpresa = False
Try
If oFnz.OpenConn(ConfigurationManager.AppSettings("sqlConnectionString"), oConn) = True Then
sCmdText = "sp_tCribisRicercaReportImpresa_Insert"
oCmd = New SqlClient.SqlCommand(sCmdText, oConn)
oCmd.CommandType = CommandType.StoredProcedure
oParam = oCmd.Parameters.Add("@rp_id", SqlDbType.Decimal, 10)
oParam.Direction = ParameterDirection.Output
'sAppo = sAppo & TrasformXML(oResp.CRHReportHTML.GUID)
sAppo = oCribis.GetPdfDoc(sCribisToken, nTipoDoc, oResp.CRHReportHTML.GUID, sDescrErrore)
oCmd.Parameters.Add(New SqlClient.SqlParameter("@rp_idAnagra", oCast.cDblNullSP(nIDCliente)))
Select Case nTipoDoc
Case 12, 13, 14
oCmd.Parameters.Add(New SqlClient.SqlParameter("@rp_tipo", "G"))
Case 9, 10, 11
oCmd.Parameters.Add(New SqlClient.SqlParameter("@rp_tipo", "S"))
Case 15, 16, 17
oCmd.Parameters.Add(New SqlClient.SqlParameter("@rp_tipo", "P"))
End Select
oCmd.Parameters.Add(New SqlClient.SqlParameter("@rp_Prov", oCast.cStrNullSP(sInputProv)))
oCmd.Parameters.Add(New SqlClient.SqlParameter("@rp_Rea", oCast.cStrNullSP(sInputRea)))
Select Case nTipoDoc
Case 9, 12, 15
oCmd.Parameters.Add(New SqlClient.SqlParameter("@rp_QtaAnno", oCast.cDblNullSP(0)))
Case 10, 13, 16
oCmd.Parameters.Add(New SqlClient.SqlParameter("@rp_QtaAnno", oCast.cDblNullSP(1)))
Case 11, 14, 17
oCmd.Parameters.Add(New SqlClient.SqlParameter("@rp_QtaAnno", oCast.cDblNullSP(3)))
End Select
'oCmd.Parameters.Add(New SqlClient.SqlParameter("@rp_valore", oCast.cStrNullSP(sAppo))
oCmd.Parameters.Add(New SqlClient.SqlParameter("@rp_nomefile", oCast.cStrNullSP(sAppo))) (riga 3601)
oCmd.ExecuteNonQuery()
nIdOutput = oCast.cNullDbl(oCmd.Parameters("@rp_id").Value)
oCmd = Nothing
'If sKey <> "" Then sKey = sKey & ", "
sKey = CStr(nIdOutput)
Public Function cStrNullSP(ByVal oIn As Object) As Object
If oIn.ToString.Trim = "" Then (riga 146)
Return DBNull.Value
Else
Return CStr(oIn.ToString)
End If
End Function
Return True
End If
Catch ex As Exception
oFnz.GestError(ex, System.Reflection.MethodInfo.GetCurrentMethod.Name, nIDCliente, sKey)
End Try
End Function