Quantcast
Channel: Windows Forms Data Controls and Databinding forum
Viewing all articles
Browse latest Browse all 2535

combobox to allow zero in table (winforms, c#)

$
0
0

Hello.  Have a situation in which the user may not have or know the jurisdiction and not able to enter it when adding a new company.  I currently have the following code for the insert and update of the field.  But I need to have it enter zero if nothing selected.  The field in the table is not a FK and does allow null.  I would prefer zero over null.  I suspect it has something to do with the part that ends .Equals(0).  The combobox will always have the jurisdictions listed in it.  What do I need to remove or add to this line?

Thanks...John 

command.Parameters.AddWithValue("@jurisdictionid", !cboJurisdictionID.Items.Count.Equals(0) ? cboJurisdictionID.SelectedValue : 0);

 


Viewing all articles
Browse latest Browse all 2535

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>