开发者

Creating SQLDataSource

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜