Trying a db insert but fails due to nothing being passed in one of my form fields...
Posted on 2004-08-12
I am trying to do a simple database insert, however, I seem to have a problem because the column in my table is set to
stateProvinceCode nchar(3) and does not accept nulls
I have a drop down box on my page like so
<select name="stateProvince" id="stateProvince">
<option value="">Select One</option>
I want to be able to submit my form without having to choose a State/Province. If I choose nothing it passes "" which seems to cause a problem, because if I choose a state, I do not get any error.
If my column is set to not accept nulls, and has a datatype of nchar(3) how can I get around this?
The stateProvinceCode column is a FK from another table, a table called StateProvince
Should be simple to fix, but I can't seem to get it.
Any help appreciated.