Int to Null

Posts   
 
    
wexa
User
Posts: 38
Joined: 27-Jul-2007
# Posted on: 23-Oct-2007 04:36:14   

I must call a stored proc that receives an int, but it sometimes can be null to avoid key errors.

How can you send a null value if the generated code has defined int for the stored proc?


public static DataTable AddPartidaPedido(System.Int32 pId, System.Int32 pDetalle, System.Int32 pMaterial, System.Double pCantidad, System.Double pPrecio, System.Int32 pUnidad, System.Int32 pMedida, System.Int32 pColor, System.Double pPorcDp, System.String pComentario, System.DateTime pFPromEnt,  
System.Double pPnc)
        {
            using(DataAccessAdapter adapter = new DataAccessAdapter()) 
            {
                return AddPartidaPedido(pId, pDetalle, pMaterial, pCantidad, pPrecio, pUnidad, pMedida, pColor, pPorcDp, pComentario, pFPromEnt,  
pPnc,  adapter);
            }

I Must send null values to the 6 and 7 parameters.

I have been reading about boxing and unboxing but not success, also trying to send DBnull and still no success.

Thanks for your help

daelmo avatar
daelmo
Support Team
Posts: 8245
Joined: 28-Nov-2005
# Posted on: 23-Oct-2007 05:26:19   

Hi wexa,

Here is a solution for your problem: http://www.llblgen.com/tinyforum/Messages.aspx?ThreadID=2929

Please let us know if it worked for you wink

David Elizondo | LLBLGen Support Team