How to handel an 'Integer not-null field'

How to handel an 'Integer not-null field'

Postby afva » Mon 17 Aug 2009 09:44

Hello,

I have a table with a colum 'Total' of type: Number(12) not NULL.
I use devart LINQ-to_slq to create a class.

How do you handle this in the interface when the field has a value NULL?
I don't want to show the default text 'Input string was not in the correct format', but I cannot 'catch' this value to use my own validation-rules because the interface (onChange..) does'n allow a null-value)

When I add a new record it shows a '0' in the field and I prefer to show an empty field.

The solution I came up with, is to make the column a NULL-column when creating the class. In my validation-rules I can catch a null-value,
but that doens't feel good.
Is ther another solution?

Thanks in advance.
(I use an Oracle database with WPF v2008)
afva
 
Posts: 39
Joined: Thu 13 Aug 2009 21:22

Postby AndreyR » Mon 17 Aug 2009 10:57

The solution you've described is appropriate in case you have implemented validation rules transforming null values
into some default value or showing proper error message depending on the logic of your application.
AndreyR
Devart Team
 
Posts: 2919
Joined: Mon 07 Jul 2008 13:16

Other option

Postby afva » Mon 17 Aug 2009 11:22

Hello AndreyR,
Thanks for the response.

I actually don/t want to use this solution. I am in a testing envorionment and this means that everytime I want to create the new linq-to-sql class, I have to look for columns of type integer NOT NULL, and make the changes manually.
I am trying to avoid this.

Is there another solution?
afva
 
Posts: 39
Joined: Thu 13 Aug 2009 21:22

Postby AndreyR » Mon 17 Aug 2009 12:28

Please send me (support * devart * com) a test project illustrating the scenario you are
implementing, maybe I will be able to give you a better piece of advice.
AndreyR
Devart Team
 
Posts: 2919
Joined: Mon 07 Jul 2008 13:16

Postby afva » Mon 17 Aug 2009 13:58

Hello Andrey,

I just send you a document and a .rar file.
Thanks
afva
 
Posts: 39
Joined: Thu 13 Aug 2009 21:22


Return to dotConnect for Oracle