I am populating a DataGrid in C# from two tables. Table1 has several columns, one of which is a TypeID which contains a numeric ID. When I'm populating my grid I'm taking this ID, and doing an inner join to get the actual type string. Eg ID 1 = Bank, ID 2 = Shop, etc.
However I'm rather stuck on what to do for an update, if the Type is changed in my grid (by selecting the string from a drop-down list) how can I update Table1 with the correct ID value? I figure I could have several UPDATE and SELECT queries, but I'm hoping there is a more efficient way. Something like:
UPDATE Table1 SET TypeID = Table2.ID WHERE Table2.Description = 'WhateverUserSelects'