StrataFrame Forum

INSERT fails

http://forum.strataframe.net/Topic2489.aspx

By Gerhard Jaros - 8/28/2006

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...

By Trent L. Taylor - 8/28/2006

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