Share via

allow null in database

Kim 41 Reputation points
2022-05-08T08:33:16.473+00:00

I have a query where I calculate the total sum of an item based on different prices.
If I enter a new article and I leave certain cells empty, the price is calculated correctly with an empty cell.
If I now put a value in the empty cell, the calculation also happens correctly, but the cell cannot be emptied afterwards (no empty cell is allowed).
In the DB it says "Allow null's"
This only happens in cells where a number is stated, not in a cell with text.

CREATE VIEW dbo.Particulier
AS
SELECT        Auto_Merk, Plaats, ref_vast, ref_es, Ref, Omschrijving, Datum, snijden, snijden_foto, Bol, ref_set7P, ref_set13P, werk_vast, werk_orig, werk_es, opleg_13P, Caravan, prijs_vast, prijs_es, prijs_set7P, prijs_set13P, Spoiler_ref, 
                         Spoiler_prijs, Codering, Codering_prijs, Uitbreidingsset, Uitbreidingsset_prijs, PDC_uitschakeling, ROUND((prijs_es * 1.21 + werk_es + prijs_set7P + ISNULL(Spoiler_prijs, '0') + ISNULL(Codering_prijs, '0') 
                         + ISNULL(Uitbreidingsset_prijs, '0')) / 10, 0) * 10 AS geplaatstes, ROUND((prijs_vast * 1.21 + werk_orig + prijs_set7P + ISNULL(Spoiler_prijs, '0') + ISNULL(Codering_prijs, '0') + ISNULL(Uitbreidingsset_prijs, '0')) / 10, 0) 
                         * 10 AS geplaatstorig, ROUND((prijs_vast * 1.21 + werk_vast + prijs_set7P + ISNULL(Spoiler_prijs, '0') + ISNULL(Codering_prijs, '0') + ISNULL(Uitbreidingsset_prijs, '0')) / 10, 0) * 10 AS geplaatstvast, checkvast, checkorig, 
                         checkes, Cataloog_ID
FROM            dbo.Cataloog
Developer technologies | VB
0 comments No comments

3 answers

Sort by: Most helpful
  1. Kim 41 Reputation points
    2022-05-12T08:00:49.797+00:00

    I don't think the problem is in saving once I clear the cell I can't select anything else.
    Something has to be filled in first before I can continue.
    Could this be because the cell is used in a query calculation and therefore cannot be empty?

    Was this answer helpful?

    0 comments No comments

  2. Kim 41 Reputation points
    2022-05-11T14:58:51.24+00:00

    it's a winform and i use this code to save the data.

     Function Save_cataloog() As Boolean
            Try
                Me.Validate()
                Me.CataloogBindingSource.EndEdit()
                Me.CataloogTableAdapter.Update(Me.CataloogDataSet.Cataloog)
    
                Return True
            Catch ex As Exception
                MsgBox(ex.ToString)
                Return False
            End Try
        End Function
    

    Was this answer helpful?


  3. Viorel 127K Reputation points
    2022-05-08T08:39:32.437+00:00

    If you are using Management Studio, then try pressing <Ctrl+0> to empty the numeric nullable cell.

    Was this answer helpful?


Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.