DGV Value Translation
-
Hello everyone, Here is a scenario: Front End: MSVS2005 - C# - DGV Back End: MS SQL Server2005 - Stored Procedures On the backend the main table contains a column named "OfficeID", tinyint, and in another table named "Offices" there are three coulmns "OfficeID", tinyint (PK); "OfficeName", nchar; and "OfficeAbb", nchar. In my SELECT stored procedure I do an INNER JOIN of "OfficeID" columns in these two tables and display the OfficeAbb string on my front end DataGridView when I call the SELECT stored procedure instead of that tinyint stored in the main table. This works great and DGV displays the Office Abbreviation based on the tinyint stored in the OfficeID column of the main table. However, when I try to call my UPDATE stored procedure to update the main table I get "Failed to convert parameter value from a String to a Byte" because the DataSet now holds that two letter string office abbreviation and apparently the DataAdapter is not smart enough to lookup the Offices table and replace the string with the OfficeID tinyint for me. I guess I either have to use some method of the DataAdapter to instruct it to translate the string into the tinyint based on the Office table values or to change the UPDATE stored procedure to where it would accept the string and than do the value translation for me. I suspect both options are possible but was unable to Google this out despite this being such a common scenario. Any help is appreciated. Thanks for reading, Dean