1 (edited by identity 2016-02-07 09:30:44)

Topic: Not Null Constraint Failed

Hi
In My project I have encountered a problem so I make another project which is like mine but simpler.
the problem is when I want to save the textboxes in form4 it displays an error: ( Not Null Constraint Failed: formtwo.id_formone )
I know there are other ways to save the textboxes but believe me my real project is bigger than the attached project and it has about 20 Forms and I can not delete any forms.
So please do not change the Forms in this project, just tell me what I'm doing wrong?
by the way I'm useing version 1.45
thanks

Post's attachments

Attachment icon 123.rar 293.37 kb, 450 downloads since 2016-02-07 

Re: Not Null Constraint Failed

Hello Identity,
If you don't want to change your forms, you can delete sqlite.db and let MVD recreate it when the project next runs.  This cleared the error when I tried it.
A bigger problem is that in Form 4, you are adding "formtwo" records without relating them to a parent "formone" record - but in your database schema you have specified such a relationship.  Maybe this is just in the example project you uploaded and in your real project the records are related correctly?

Re: Not Null Constraint Failed

Thanks Derek for your fast reply
You said :  in Form 4, I added "formtwo" records without relating them to a parent "formone" record.
How can I do that?
thanks

Re: Not Null Constraint Failed

You have mandatory and enabled cascase delete for this field:
Formtwo.id_Formone


just remove this field, then create again without Not null and Cascade delete option.

Dmitry.

5 (edited by identity 2016-02-08 05:01:50)

Re: Not Null Constraint Failed

thank you
I did as you said and it worked
but there is another problem: in Form 2 the action of the button2 (Add button) is set on "New Record"
what I like to do is that I need to specify many details about the staff of an office. all of these details are defined in textboxes which are about 20 textboxes and there is also a TableGrid which I can't place it in the Form2 so I have no choice but to place this TableGrid in another Form which is Form3.
the problem is in that TableGrid there should be the data related to only one staff but when I click on the button2 (Add button) to add a new record, all the data related to every staff can also be seen in the TableGrid
By the way in the properties section of the TableGrid I did not check the "Auto Execution of the query" so why all of the new records that I save is in that TableGrid???
Do you get what I mean?
thanks

Re: Not Null Constraint Failed

identity
You should place TableGrid with child records on the Form2 otherwise you need to use script to do this, but it's impossible in the old version (1.45)

Dmitry.