The following is the definition of my stored procedure:PROCEDURE [dbo].[sp_GetShiftManagement] AS BEGINSELECT m.ID, m.[Group] AS 'Group', m.[Shift], m.Dept, e.Firstname+' '+e.Lastname AS 'Manager', m.MgrNum, m.Schedule, m.SubGroupFROM ShiftManage m INNER JOIN EmployeeInfo e ON (m.MgrNum=e.Num) ORDER BY m.IDEND
I fill this data into my ShiftManager data table in Visual Studio and query it as needed:DataRow[] QueryShiftManager(string sqlText) { return ShiftManager.Select(sqlText);}
I have been getting 0 records for data that I knew to be there. I queried the table directly by punching in everything into Query Analyzer:SELECT m.ID, m.[Group] AS 'Group', m.[Shift], m.Dept, e.Firstname+' '+e.Lastname AS 'Manager', m.MgrNum, m.Schedule, m.SubGroupFROM ShiftManage m INNER JOIN EmployeeInfo e ON (m.MgrNum=e.Num)where (Shift='1') AND ([Group]='OFFICE') AND (Dept='ENGINEERING') ORDER BY m.ID
That was where I found 'Ambiguous column name' errors, because the INNER JOIN EmployeeInfo table also contains the fields I am trying to filter - namely 'SHIFT', 'GROUP', and 'DEPT'.I can only guess that somehow my DataTable still knows about the non-selected fields from the INNER JOIN table.How do I tell a DataTable's Select command that I only want to select from the rows and columns in the actual table??? ...or, am I missing something else?Renaming the Stored Procedure's output columns is possible, but would add several weeks of debugging out new column name changes.Thanks in advance,~Joe
Avoid Sears Home Improvement