A
André
Hi,
I have a gridview with Delete button in order to delete a row. When a row is
deleted, i want to count from the table the number of occurence of the value
of a specific field in the deleted. In this example, the field is 'vlg'.
Assume the value of field 'vlg' is '230', then i want to know after having
deleting the row from the gridview, how many times the value '230' remains
in the table.
My problem: this code counts the number of '230' in field 'vlg' not AFTER
the row is deleted but BEFORE the row is deleted.
Is this normal and how to count after the row is deleted?
Thanks
André.
<asp:SqlDataSource ID="SqlDataSource1" runat="server"
ConnectionString="<%$ ConnectionStrings:enquete %>"
DeleteCommand="DELETE FROM [condition] WHERE [id] = @id" >
<DeleteParameters>
<asparameter Name="id" Type="Int32" />
</DeleteParameters>
</asp:SqlDataSource>
<asp:GridView ID="GridView1" runat="server" >
.....
Protected Sub GridView1_RowDeleted(ByVal sender As Object, ByVal e As
System.Web.UI.WebControls.GridViewDeletedEventArgs) Handles
GridView1.RowDeleted
....
connection.Open()
comd.CommandText = "SELECT COUNT(*) from mytable WHERE vlg = 'value
of field vlg in deleted row (here 230)'
nca = comd.ExecuteScalar
end Sub
I have a gridview with Delete button in order to delete a row. When a row is
deleted, i want to count from the table the number of occurence of the value
of a specific field in the deleted. In this example, the field is 'vlg'.
Assume the value of field 'vlg' is '230', then i want to know after having
deleting the row from the gridview, how many times the value '230' remains
in the table.
My problem: this code counts the number of '230' in field 'vlg' not AFTER
the row is deleted but BEFORE the row is deleted.
Is this normal and how to count after the row is deleted?
Thanks
André.
<asp:SqlDataSource ID="SqlDataSource1" runat="server"
ConnectionString="<%$ ConnectionStrings:enquete %>"
DeleteCommand="DELETE FROM [condition] WHERE [id] = @id" >
<DeleteParameters>
<asparameter Name="id" Type="Int32" />
</DeleteParameters>
</asp:SqlDataSource>
<asp:GridView ID="GridView1" runat="server" >
.....
Protected Sub GridView1_RowDeleted(ByVal sender As Object, ByVal e As
System.Web.UI.WebControls.GridViewDeletedEventArgs) Handles
GridView1.RowDeleted
....
connection.Open()
comd.CommandText = "SELECT COUNT(*) from mytable WHERE vlg = 'value
of field vlg in deleted row (here 230)'
nca = comd.ExecuteScalar
end Sub