具体代码如下
<asp:SqlDataSource
id="srcEmployeeDetails"
ConnectionString="<%$ ConnectionStrings:Employees %>"
SelectCommand="SELECT * FROM Employees
WHERE FirstName=@FirstName AND LastName=@LastName"
Runat="server">
<SelectParameters>
<asp:ControlParameter
Name="FirstName"
ControlID="grdEmployees"
PropertyName='SelectedDataKey("FirstName")' />
<asp:ControlParameter
Name="LastName"
ControlID="grdEmployees"
PropertyName='SelectedDataKey("LastName")' />
</SelectParameters>
</asp:SqlDataSource>
貌似是PropertyName='SelectedDataKey("FirstName")'这个地方用()和[]都没有错误,这是为什么呢?这个地方应该是个索引器,索引器不是应该用中括号么?
慕莱坞森