Thanks Sam in advance.
I am using ASP.NET GridView.
Here is what I am exactly doing:
Grid view:
<asp:GridView ID="GridView2" runat="server" DataSourceID="SqlDataSource3" AutoGenerateColumns="False">
<Columns>
<asp:CommandField ShowDeleteButton="True" />
<asp:BoundField DataField="USER_ID" HeaderText="USER_ID" InsertVisible="False" ReadOnly="True"
SortExpression="USER_ID" />
<asp:BoundField DataField="USER_FIRSTNAME" HeaderText="USER_FIRSTNAME" SortExpression="USER_FIRSTNAME" />
<asp:BoundField DataField="USER_LASTNAME" HeaderText="USER_LASTNAME" SortExpression="USER_LASTNAME" />
<asp:BoundField DataField="WORKREL_USER_ID" HeaderText="WORKREL_USER_ID" InsertVisible="False"
ReadOnly="True" SortExpression="WORKREL_USER_ID" />
</Columns>
</asp:GridView>
User Firstname, Lastname and Id are part of the tblUSERS then WORKREL_USER_ID column is part of tblWORKRELATIONSHIP_USER.
Here is the dataSource that I am using for this grid:
<asp:SqlDataSource ID="SqlDataSource3" runat="server" ConnectionString="<%$ ConnectionStrings:itworks %>"
SelectCommand="uspEmpSelectedinWorkRel" SelectCommandType="StoredProcedure"
DeleteCommand="uspEmpinWorkRelDelete" DeleteCommandType="StoredProcedure">
<DeleteParameters>
<asp:Parameter Direction="ReturnValue" Name="RETURN_VALUE" />
<asp:Parameter Name="WORKREL_USER_ID" Type="Int32" />
</DeleteParameters>
<SelectParameters>
<asp:ControlParameter ControlID="ddlWorkRel" DefaultValue="1" Name="WORKREL_ID" PropertyName="SelectedValue"
Type="Int32" />
</SelectParameters>
</asp:SqlDataSource>
When I want to delete one row it says that WORKREL_ID parameter has not been specified.
Here is the storede procedure I am using to fill GridView2:
SELECT tblUSERS.USER_ID,USER_FIRSTNAME, USER_LASTNAME, tblWORKRELATIONSHIP_USER.WORKREL_USER_ID FROM tblUSERS
INNER JOIN tblWORKRELATIONSHIP_USER ON
tblUSERS.USER_ID = tblWORKRELATIONSHIP_USER.USER_ID
WHERE tblWORKRELATIONSHIP_USER.WORKREL_ID = @WORKREL_ID
And here is the delete stored procedure:
DELETE FROM tblWORKRELATIONSHIP_USER WHERE WORKREL_USER_ID = @WORKREL_USER_ID
I really thank you in advance and I hope you can help me with this problem
|