DynamicData / LinqtoSql using triggers and nullable int columns RRS feed

  • Question

  • I have a DynamicData project that has a particular column in a table which is a nullable int type and will be used as a sequence of numbers to track inbound freight transactions.
    I created a trigger to insert the value for this column on inserting the record into the table.



    trigger [dbo].[Inbounds$InsertTrigger] on [dbo].[Inbounds]



    of insert




    declare @ibno as int


    set @ibno = (select MAX(IB_NO)


    FROM Inbounds)


    if @ibno is null


    set @ibno = 1



    insert into Inbounds


    select DeliveryDate,VendorID, PO_NO, IB_NO = @ibno , Shipper, Diameter, Wall, Qty_Length, Qty_Type, CustID, JobID from INSERTED


    This works fine when inserting a record via SSMS but fails when inserting via the DynamicData page.  The error is 'The null value cannot be assigned to a member with type System.Int32 which is a non-nullable value type.

    I was under the impression that DynamicData handled nullable int types just fine.  Am I mistaken or did I miss a setting somewhere?


    Sunday, August 16, 2009 2:48 PM

All replies