I'm using Visual Studio 2010 to develop a very simple VB form. It has a datagrid bound to Table1. One of the columns is a combo box which is populated from a separate database table - Table2.
The datagridview displays as I would expect, translating the lookup field in table1 to show the correct description from table2 and the dropdown itself displays the correct list of descriptions. However, if I change the dropdown selection then move to a different row, I get an error for the DataGridView:
"Cannot set column 'Tb1Type'. The value violates the the MaxLength limit of this column"
The 'Tb1Type' field (in Table1) is used to lookup the matching 'Tb2Type' field (in Table2) to retrieve the appropriate Tb2Description value(s).
It's as if the logic is trying to write back the description to the database instead of the corresponding Tb2Type value. Indeed if I select a description from the list that is less than 5 characters (the Tb1Type and Tb2Type fields are both varchar(5) while Tb2Desc is varchar(50)), the error does not arise.
Can anyone offer any suggestions as to where I might be going wrong here please?
The datagridview displays as I would expect, translating the lookup field in table1 to show the correct description from table2 and the dropdown itself displays the correct list of descriptions. However, if I change the dropdown selection then move to a different row, I get an error for the DataGridView:
"Cannot set column 'Tb1Type'. The value violates the the MaxLength limit of this column"
The 'Tb1Type' field (in Table1) is used to lookup the matching 'Tb2Type' field (in Table2) to retrieve the appropriate Tb2Description value(s).
It's as if the logic is trying to write back the description to the database instead of the corresponding Tb2Type value. Indeed if I select a description from the list that is less than 5 characters (the Tb1Type and Tb2Type fields are both varchar(5) while Tb2Desc is varchar(50)), the error does not arise.
Can anyone offer any suggestions as to where I might be going wrong here please?