INSERT fails


Author
Message
Gerhard Jaros
Gerhard Jaros
StrataFrame Beginner (22 reputation)StrataFrame Beginner (22 reputation)StrataFrame Beginner (22 reputation)StrataFrame Beginner (22 reputation)StrataFrame Beginner (22 reputation)StrataFrame Beginner (22 reputation)StrataFrame Beginner (22 reputation)StrataFrame Beginner (22 reputation)StrataFrame Beginner (22 reputation)
Group: Forum Members
Posts: 18, Visits: 22
Hello,

The SELECT and the EDIT functions work well in my App, however INSERT fails with the following message:

BusinessLayerException
 An error occurred while saving an the data to the server.
DataLayerSavingException
 Cannot insert the value NULL into column 'id_saison', table 'EKZ7.dbo.Saison'; column does not allow nulls. INSERT fails.
The statement has been terminated.
SqlException
 Cannot insert the value NULL into column 'id_saison', table 'EKZ7.dbo.Saison'; column does not allow nulls. INSERT fails.
The statement has been terminated.

Source     : MicroFour StrataFrame Business

Stack Trace:
   at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection)

   [...]

Well, it is true, I do not allow nulls in the column id_saison because this is my primary key column.

This happens with all tables I have in my database and that's why I guess that I just haven't set up the database properly.

Thanks for your help, ...gerhard...

Trent Taylor
Trent Taylor
StrataFrame Developer (8.7K reputation)StrataFrame Developer (8.7K reputation)StrataFrame Developer (8.7K reputation)StrataFrame Developer (8.7K reputation)StrataFrame Developer (8.7K reputation)StrataFrame Developer (8.7K reputation)StrataFrame Developer (8.7K reputation)StrataFrame Developer (8.7K reputation)StrataFrame Developer (8.7K reputation)
Group: StrataFrame Developers
Posts: 6.6K, Visits: 6.9K
Gerhard,

This is due to your database design.  You have the AllowNullValuesOnNewRow property set to Fasle on a business object, it will automatically initialize the row for you.  But bottom line is that this is a SQL Server error and it means what it says.  If you do not provide a value and the field is NULL, it will throw an exception.  First, try setting the AllowNullValuesOnNewRow property to False.  Also, have you added an auto-incrementing integer primary key to your table strucutres as we had talked about before?  I know this is not necessary in order to work with StrataFrame and BOs, but in your case I think this would make things much easier for you.  Thanks

GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search