PDA

View Full Version : مشکل حذف در gridview



hadi88
دوشنبه 24 خرداد 1395, 04:36 صبح
سلام
من یک gridview دارم وصل کردم به پایگاه داده حالا می خوام یک سطر رو حذف کنم ولی خطای Must declare the scalar variable "@radif" میده.
لطفا یه کی کمکم کنه
<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False"
DataSourceID="SqlDataSource1">
<Columns>
<asp:CommandField ShowDeleteButton="True" />

<asp:BoundField DataField="radif" HeaderText="radif" SortExpression="radif"
InsertVisible="False" ReadOnly="True" />
<asp:BoundField DataField="username" HeaderText="username"
SortExpression="username" />
<asp:BoundField DataField="date" HeaderText="date" SortExpression="date" />
<asp:BoundField DataField="logout" HeaderText="logout"
SortExpression="logout" />
<asp:BoundField DataField="login" HeaderText="login"
SortExpression="login" />
<asp:BoundField DataField="time" HeaderText="time"
SortExpression="time" />
<asp:BoundField DataField="cause1" HeaderText="cause1"
SortExpression="cause1" />
<asp:BoundField DataField="cause2" HeaderText="cause2"
SortExpression="cause2" />
</Columns>
</asp:GridView>
<asp:SqlDataSource ID="SqlDataSource1" runat="server"
ConnectionString="<%$ ConnectionStrings:ConnectionString %>"
DeleteCommand="DELETE FROM tbagent WHERE (radif =@radif)"
SelectCommand="SELECT * FROM [tbagent] WHERE (([username] = @username) AND ([date] = @date))">
<SelectParameters>
<asp:ControlParameter ControlID="lbl_user" Name="username" PropertyName="Text"
Type="String" />
<asp:ControlParameter ControlID="lbl_date" Name="date" PropertyName="Text"
Type="String" />
</SelectParameters>
</asp:SqlDataSource>