TableAdapter SQL Update Help

joe_pool_is

Well-known member
Joined
Jan 18, 2004
Messages
451
Location
Texas
I have 2 tables: EmployeeInfo and MGRSPV (Manager/Supervisor).

On the DataGridView, we modified the EmployeeInfo Tables Fill/GetData to replace the EmployeeInfo.MGR value with the Manager/Supervisors name from MGRSPV.[MGR/SPVSR] as follows:
Code:
SELECT       EmployeeInfo.FIRSTNAME, EmployeeInfo.LASTNAME, MGRSPV.[MGR/SPVSR]
FROM         EmployeeInfo
INNER JOIN  MGRSPV ON EmployeeInfo.MGR = MGRSPV.ID

It was working great, but crashed with an unhandled exception whenever I tried to Save data on the AutoGenerated line below. Now, VS refuses to compile:
this.employeeInfoTableAdapter.Update(this.SqlSrvrDataSet.EmployeeInfo);
EmployeeInfoTableAdapter does not contain a definition for Update

I guess this means I need to write a custom Update query for the EmployeeInfo Table. Right?

How would I write the statement?

How would I later use the statement in my code? Do I need to manually read in and supply parameters from my form? How would they be inserted? Using SqlParameter with ParameterName/Value pairs seems like it would work, but then Id need an SqlCommand and have to find a way to update the TableAdapter.

The Wizard created everything on this except for the custom Fill/GetData SQL piece, so I am left out in the cold!
 
Back
Top