?
Solved

InfoPath- how to submit NULL for a SQL foreign key

Posted on 2009-12-28
3
Medium Priority
?
374 Views
Last Modified: 2012-08-14
Hi,
I am doing query/submit with InfoPath to SQL via a web service.  My database contains a foreign key which can be null.  This foreign key is defined in SQL as an int.  Since it's an int, InfoPath insists on an integer.   I cannot leave it blank in InfoPath, since that's not an int.
I think I probably have similar problems with my Date columns which can also be null in SQL.  How do people usually do this?  
Thanks.  
0
Comment
Question by:FingPhoto
  • 2
3 Comments
 
LVL 28

Expert Comment

by:clayfox
ID: 26132086
Switch from using nulls to using 0 to fix your int issue.  For the data typically a default date from 1800 or whatever is used.
0
 

Author Comment

by:FingPhoto
ID: 26138163
Thank you.  Are you saying that InfoPath should send a 0, and that my webservice should special-case the 0 and stick in a null?  

0
 
LVL 28

Accepted Solution

by:
clayfox earned 2000 total points
ID: 26153767
You could do that, have the web service make the conversion, or just use a zero in SQL rather than a null.
0

Featured Post

Veeam and MySQL: How to Perform Backup & Recovery

MySQL and the MariaDB variant are among the most used databases in Linux environments, and many critical applications support their data on them. Watch this recorded webinar to find out how Veeam Backup & Replication allows you to get consistent backups of MySQL databases.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

It is possible to export the data of a SQL Table in SSMS and generate INSERT statements. It's neatly tucked away in the generate scripts option of a database.
Windocks is an independent port of Docker's open source to Windows.   This article introduces the use of SQL Server in containers, with integrated support of SQL Server database cloning.
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.
Via a live example, show how to set up a backup for SQL Server using a Maintenance Plan and how to schedule the job into SQL Server Agent.
Suggested Courses

864 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question