开发者

Creating SQLDataSource

开发者 https://www.devze.com 2022-12-30 01:27 出处:网络
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 DropD

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. c开发者_Go百科ustom grid and source?


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
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号