none
Update record, Row not found or changed. RRS feed

  • Question

  • I have a problem with a update. Some records is possible to update. And some are not. 

    I have read some threads here and from what i understand it is because the data has been changed since the fetch. The SQL running against the db is:

    SELECT [t0].[Name], [t0].[PostAdressRow1], [t0].[PostAdressRow2], [t0].[PostAdressPostnumber], [t0].[PostAdressPostort], [t0].[VisitAdressRow1], [t0].[VisitAdressRow2], [t0].[VisitAdressPostnumber], [t0].[VisitAdressPostort], [t0].[Organisationsnr], [t0].[SNICode] AS [SNICode1], [t0].[NumberOfEmployees], [t0].[CalculatedTurnover], [t0].[CustomerID], [t0].[CRMCustomerID], [t0].[KreditRating]

    FROM [dbo].[CRMCustomer] AS [t0]

    WHERE [t0].[Organisationsnr] = @p0

    -- @p0: Input BigInt (Size = 0; Prec = 0; Scale = 0) [5562756212]

    -- Context: SqlProvider(Sql2005) Model: AttributedMetaModel Build: 3.5.21022.8

    UPDATE [dbo].[CRMCustomer]

    SET [Name] = @p0

    WHERE 0 = 1

    SELECT [t1].[CRMCustomerID]

    FROM [dbo].[CRMCustomer] AS [t1]

    WHERE ((@@ROWCOUNT) > 0) AND ([t1].[Organisationsnr] = @p1)

    -- @p0: Input NChar (Size = 50; Prec = 0; Scale = 0) [3]

    -- @p1: Input BigInt (Size = 0; Prec = 0; Scale = 0) [5562756212]

    -- Context: SqlProvider(Sql2005) Model: AttributedMetaModel Build: 3.5.21022.8

     as you can se the WHERE 0 = 1 is not going the help the update very mush. The question is WHY is this happening? The difference on the record that get interupted when updating is that it has multiple fields with NULL values. Is this a possible source of error?

    Thnx
    Sunday, December 14, 2008 9:01 PM

All replies

  • This is likely caused by one of the fields you are setting to null not actually allowing null.  Make sure your DBML is up to date with any changes you have subsequently made to the table schema.

    [)amien
    http://damieng.com/
    Monday, December 15, 2008 4:02 AM
    Moderator