Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MIssing Columns for XML Export Requiring Not Null #8

Open
marksburgess opened this issue Sep 12, 2015 · 6 comments
Open

MIssing Columns for XML Export Requiring Not Null #8

marksburgess opened this issue Sep 12, 2015 · 6 comments

Comments

@marksburgess
Copy link

The survey export from both 2.3 and 2.1 does not include (vts_Survey) FolderId and DefaultSurvey in the exported XML. Both columns are defined as "not null" so the import into 2.3 fails. Saving a new survey also fails with the same error: Cannot insert the value NULL into column 'FolderId', table 'surveyproject.dbo.vts_tbSurvey'; column does not allow nulls. INSERT fails.

@marksburgess
Copy link
Author

Turning off constraint to saving tables and allowing nulls in both fields, yields the following error when attempting to create a new survey: The INSERT statement conflicted with the FOREIGN KEY constraint "FK_vts_tbSurvey_vts_tbNotificationMode". The conflict occurred in database "surveyproject", table "dbo.vts_tbNotificationMode", column 'NotificationModeID'.

@marksburgess
Copy link
Author

The same problem does not occur in local copies running on SQL Express and IIS

@fwsmaster
Copy link
Contributor

Thank you for reporting. This and similar issues (e.g. export a question from a library to xml and next import question into survey --> insert null value error) seem related to the working of either Mssqlserver 2014 or the latest .NET version (4.6). Previously (as you noticed on Sql express - what version?) the issue did not exist. Any suggestions to fix this are most welcome.

@marksburgess
Copy link
Author

Exploring this so far, for the XML import, the answer appears to be that Microsoft dropped "Smart Defaults" from the Web Deployment choices. That function would enter a default value in columns specified with NOT NULL. For the code, it looks like "default" needs to be added for those columns to the insert query when creating a new survey.

@marksburgess
Copy link
Author

I added this code:
if @pid is null
select @pid = 1
to SuveryAddNew stored procedure just after the first select query, but I'm not sure that did the trick. It looked to me like there were cases where folderid would be empty but @pid was still being set to that.

I can't delete surveys so now that I have web deploy working, I don't have a way to test an empty database.

@fwsmaster
Copy link
Contributor

Findings so far:
the code "causing" the error is most likely in the Nsurvey_BE project - Votations.NSurvey.Data diretory:

  • the automatically created .designer.cs files generate a set[...]Null() method that should fill the db table: global::System.Convert.DBNull;
  • if the set method is used it generates the insert null value error;
  • the way to fix it should be through the XSD file or by creating an alternative set...null() method;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants