I have a VB.Net 2008 Windows Application that I need to get some help with. I am using the built in data binding tools to get to a SQL 2005 database. On my form I have it bound to the database and have several controls including combo boxes for looking up state and zip codes. The lookup tables have multiple fileds. For the states there are two fields: StateID and StateName. I have relationships using the StateID. On the conbo box I have it bound to lookup data from the state lookup table. The save code is the generated code from VS, nothing complex at all. The error I get is that the MaxLength for StateFK has been violated. Now on the combo box the Display Member and Select Value items are set (i think properly). What I think is happening is that the combobox.text value is what is getting inserted into the data bound field that is bound to the form. I can post images of the form as to how the combo box is setup if needed. Thanks
John
Data Bound Combo Box
Page 1 of 12 Replies - 3970 Views - Last Post: 13 June 2008 - 07:50 AM
Replies To: Data Bound Combo Box
#2
Re: Data Bound Combo Box
Posted 12 June 2008 - 08:34 PM
Can you post the exact error message that you are getting?
#3
Re: Data Bound Combo Box
Posted 13 June 2008 - 07:50 AM
The handle is 'ArgumentException was unhandled'. Then the text is: Cannot set column 'txtState'. The value violates the MaxLength limit of this column.
Now txtState is the field that the combo box is bound to. From what I can tell, the value that is trying to get put into txtState is the combobox.text value which does exceed the limit of MaxLength. The value that should be inserted is Value Member from the lookup table or the Selected Value. Both of these I have tried to set and in either case I get the same error. Now if I take the Display Member and change it to the Value Member everything works fine.
Now txtState is the field that the combo box is bound to. From what I can tell, the value that is trying to get put into txtState is the combobox.text value which does exceed the limit of MaxLength. The value that should be inserted is Value Member from the lookup table or the Selected Value. Both of these I have tried to set and in either case I get the same error. Now if I take the Display Member and change it to the Value Member everything works fine.
Page 1 of 1
|
|

New Topic/Question
Reply




MultiQuote




|