Custom module SQL Error after upgradinbg to 4.1 SP1
Hi,
I have created a simple contact module based on the JobsIntermediate module with SSDK 4.0.
After upgrading to 4.1 SP1, and changing code to be compatible (FluentMapping etc...) I get an error executing the SaveChanges method :
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: Telerik.OpenAccess.RT.sql.SQLException: Impossible d'insérer la valeur NULL dans la colonne 'voa_version', table '...\WWW-ASALOG-COM-V4\APP_DATA\SITEFINITY.MDF.dbo.ContactsModule'. Cette colonne n'accepte pas les valeurs NULL. Échec de INSERT.
L'instruction a été arrêtée.
Source Error:
Line 144: application.SentMessage = this.SentMessage;
Line 145:
Line 146: manager.SaveChanges();
Line 147:
Line 148: NotificationMessage.ShowPositiveMessage(Res.Get<
ContactsResources
>().NotificationMessage);
Source File: D:\DOSSIERS\D02100 - asaLog Site web v4\www-asalog-com-v4\ContactsIntermediate\PublicControls\ContactApplicationSubmit.cs Line: 146
Stack Trace:
[SQLException: Impossible d'insérer la valeur NULL dans la colonne 'voa_version', table '...\WWW-ASALOG-COM-V4\APP_DATA\SITEFINITY.MDF.dbo.ContactsModule'. Cette colonne n'accepte pas les valeurs NULL. Échec de INSERT.
L'instruction a été arrêtée.]
Telerik.OpenAccess.RT.Adonet2Generic.Impl.PreparedStatementImp.execute() +919
OpenAccessRuntime.Relational.conn.PooledPreparedStatement.execute() +119
OpenAccessRuntime.Relational.RelationalStorageManager.generateInserts(NewObjectOID oid, Int32 index, ClassMetaData cmd, PersistGraph graph, Int32[] fieldNos, CharBuf s, Object[] oidData, IntArray toUpdateIndexes) +2477
[DataStoreException: Insert of '153943282-92306fc9-d4ab-47e8-a8d0-c55e08874702' failed: Telerik.OpenAccess.RT.sql.SQLException: Impossible d'insérer la valeur NULL dans la colonne 'voa_version', table '...\WWW-ASALOG-COM-V4\APP_DATA\SITEFINITY.MDF.dbo.ContactsModule'. Cette colonne n'accepte pas les valeurs NULL. Échec de INSERT.
L'instruction a été arrêtée.
at Telerik.OpenAccess.RT.Adonet2Generic.Impl.PreparedStatementImp.execute()
at OpenAccessRuntime.Relational.conn.PooledPreparedStatement.execute()
at OpenAccessRuntime.Relational.RelationalStorageManager.generateInserts(NewObjectOID oid, Int32 index, ClassMetaData cmd, PersistGraph graph, Int32[] fieldNos, CharBuf s, Object[] oidData, IntArray toUpdateIndexes)
INSERT INTO [ContactsModule] ([email], [first_name], [last_name], [phone], [referral], [description_], [title_], [url_name_], [allow_comments], [allow_track_backs], [app_name], [approve_comments], [content_id], [content_state], [date_created], [default_page_id], [draft_culture], [email_author], [expiration_date], [last_modified], [last_modified_by], [original_content_id], [ownr], [post_rights], [publication_date], [source_key], [status], [vrsion], [views_count], [visible], [votes_count], [votes_sum]) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
(set event logging to all to see parameter values) Telerik.OpenAccess.RT.sql.SQLException: Impossible d'insérer la valeur NULL dans la colonne 'voa_version', table '...\WWW-ASALOG-COM-V4\APP_DATA\SITEFINITY.MDF.dbo.ContactsModule'. Cette colonne n'accepte pas les valeurs NULL. Échec de INSERT.
L'instruction a été arrêtée.
at Telerik.OpenAccess.RT.Adonet2Generic.Impl.PreparedStatementImp.execute()
at OpenAccessRuntime.Relational.conn.PooledPreparedStatement.execute()
at OpenAccessRuntime.Relational.RelationalStorageManager.generateInserts(NewObjectOID oid, Int32 index, ClassMetaData cmd, PersistGraph graph, Int32[] fieldNos, CharBuf s, Object[] oidData, IntArray toUpdateIndexes)]
DynamicModule.ns.Wrapped_OpenAccessContactsDataProvider_778aa3be9445475d98068bc8cbd43d92.CommitTransaction() +342
Telerik.Sitefinity.Data.ManagerBase`1.SaveChanges() +53
ContactsIntermediate.PublicControls.ContactApplicationSubmit.ContactApplicationSubmit_Click(Object sender, EventArgs e) in D:\DOSSIERS\D02100 - asaLog Site web v4\www-asalog-com-v4\ContactsIntermediate\PublicControls\ContactApplicationSubmit.cs:146
System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +145
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +3410
Hi Vincent,
The error states that the column voa_version in the table ContactsModule does not allow NULL values to be inserted. You can go and modify the database table to allow nulls which should fix the issue immediately. If you allow the column to accept nulls you will not get the error, but there is some issue with your project ( or module ).
Kind regards,
Victor Velev
the Telerik team
Hi Victor,
Thank you for getting back to me and giving me a workaround.
I would like to know what is this issue coming from because :
1/ my custom module was working fine in 4.0
2/ voa-version is a hidden field, meaning it is managed by OpenAccess internaly though I don't know what I need to change, the field voa_version is not even apparent in the code
Regards
Vincent
Hello Vincent,
The error may be result of the upgrade process not conducted properly. You can change the settings of the voa_version column through the sql management tool by running such the query ( make sure to change the tables so they match yours ):
ALTER TABLE [YOURDATABASE].[dbo].[YOURTABLE]
ALTER COLUMN THECOLLUMNTHATHASTOBECHANGED varchar(20) NOT NULL;
GO