title: How do you pass null values for dbtype decimal??
body: <p>I am passing a parameter into a stored procedure:</p>
  
  <pre><code>param = CreateInParameter("Result", DbType.Decimal);
  param.Value = testresults.Result;
  cmd.Parameters.Add(param);
  </code></pre>
  
  <p>sometimes <code>testresults.Result</code> will be null</p>
  
  <p>How do I pass it in as NULL?</p>
  
  <p>Here's my stored proc:</p>
  
  <pre><code>USE [SalesDWH]
  GO
  /****** Object:  StoredProcedure [dbo].[Insert_TestResults]    Script Date: 12/25/2011 23:49:19 ******/
  SET ANSI_NULLS ON
  GO
  SET QUOTED_IDENTIFIER ON
  GO
  -- =============================================
  -- Author:      &lt;Author,,Name&gt;
  -- Create date: &lt;Create Date,,&gt;
  -- Description: &lt;Description,,&gt;
  -- =============================================
  ALTER PROCEDURE [dbo].[Insert_TestResults]
      -- Add the parameters for the stored procedure here
  
      @TestName varchar (500),
      @Result decimal (18,4)=null,
      @NonNumericResult varchar (50)=null, 
      @QuickLabDumpid int
  
  AS
  BEGIN
      -- SET NOCOUNT ON added to prevent extra result sets from
      -- interfering with SELECT statements.
      SET NOCOUNT ON;
  
  INSERT INTO [SalesDWH].[dbo].[TestResults]
             ([TestName]
             ,[Result]
             ,nonnumericresult
             ,[QuickLabDumpid])
       VALUES
             (@TestName,@Result,@nonnumericresult,@QuickLabDumpID)
  
  
  END
  </code></pre>
  
  <p>If <code>testresults.Result</code> was not assigned a value, it just goes in as 0. How do I allow it to go into the database as <code>NULL</code>?</p>