Hi,
I have an ultracombo control that gets filled by a dataset. If I do not choose anything and press the save button the value of the combo equals 'default' and the SQL stored procedure gives an error as 'default' is passed instead of null.
How can I send a null value if nothing is selected?
Thanks.
I don't understand. What do you mean by "default"? Is this a string? If so, where is it coming from? The Combo doesn't default to some arbitrary string as it's value so this must be coming from something in your code or your data.
I am using SQL Server.
One of the parameteres in my form is an ultraCombo and I pass the following parameter when updating the record.
comm.Parameters.Add("@Surgeon", SqlDbType.BigInt).Value = cmbSurgeons.Value;
However this gives an error saying that stored procedure 'xxxx' expects parameter "@Surgeon" which was not supplied.
In SQL Profiler these are the values that are passed
exec tblSurgicalProcedure_INSERT @Patient = 1715, @PerformedDate = 'Dec 21 2007 5:20:41:000PM', @Surgeon = default, @Remarks = NULL
As you can see the @Surgeon got a value of 'default' instead of null.
I'm not that familiar with SQL Profiler, but I suspect that is an artifact of how the exec string is being built, not the value of the Combo. Have you tried examining the Value property of the combo to see what's actually being returned? I notice that 'default' here is not in quotes, so it looks like it's using this to indicate that the value has not been changed.
Hi Mike,
I tried using the DataSourceNullValue. That works when I delete all the text in the comboeditor. However if I select a valid item, go to another control then back to the comboeditor and type in an invalid value and tab out, the value of the comboeditor does not change. The text of the comboeditor however still shows the invalid value. Is there a property I can set to that the text shows for the value selected instead of the invalid one? Thanks