InfoPath- how to submit NULL for a SQL foreign key

Posted on 2009-12-28
Last Modified: 2012-08-14
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?  
Question by:FingPhoto
    LVL 28

    Expert Comment

    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.

    Author Comment

    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?  

    LVL 28

    Accepted Solution

    You could do that, have the web service make the conversion, or just use a zero in SQL rather than a null.

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Threat Intelligence Starter Resources

    Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

    Having an SQL database can be a big investment for a small company. Hardware, setup and of course, the price of software all add up to a big bill that some companies may not be able to absorb.  Luckily, there is a free version SQL Express, but does …
    The Confluence of Individual Knowledge and the Collective Intelligence At this writing (summer 2013) the term API ( has made its way into the popular lexicon of the English language.  A few years ago, …
    Via a live example, show how to backup a database, simulate a failure backup the tail of the database transaction log and perform the restore.
    Via a live example, show how to shrink a transaction log file down to a reasonable size.

    759 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

    Need Help in Real-Time?

    Connect with top rated Experts

    10 Experts available now in Live!

    Get 1:1 Help Now