I have a table (EmployeeID
,EmployeeName
,ManagerID
) How can I create a SQLDataSource
to include the ManagerName
from the EmployeeName
given EmployeeID = ManagerID
? In my GridView
after dragging a DropDownList
what bindings should I do to display the ManagerName
? Is it possible to use it without writing custom SELECT
, INSERT
, DELETE
or UPDATE
? If not what are the steps I need to do to write the whole thing i.e. custom grid and source?
Asked
Active
Viewed 102 times
-1

ɐsɹǝʌ ǝɔıʌ
- 4,440
- 3
- 35
- 56

George
- 1
- 1
- 2
1 Answers
1
SQL datasource controls just allow you to easily wire up asp.net databound controls to datasources. You still have to write the correct SQL to do the relevent joins and get the data you require. e.g. you would have to write a sql commaind something like:
SELECT EmployeeTable.EmployeeName, ManagerTable.ManagerName
FROM EmployeeTable
INNER JOIN ManagerTable ON EmployeeTable.ManagerID=ManagerTable.ManagerID
WHERE EmplyeeTable.EmployeeID = @EmployeeID

Ben Robinson
- 21,601
- 5
- 62
- 79