Greetings,

I have a trigger created for table ABC to delete records from other tables connected to table ABC's key.
When I run the query from the SQL Server Management, it works without error.
However, when I call sqlDataSource's Delete(), it seems like it's not firing the triggers. Is it a right behavior for aspx to behave like that ?

Thanks.

No. If the Delete() method is being called properly, there is no reason why the trigger won't be fired. Trigger is fired by the backend database and has nothing to do with ASP.NET.

No. If the Delete() method is being called properly, there is no reason why the trigger won't be fired. Trigger is fired by the backend database and has nothing to do with ASP.NET.

Thanks hemantksh.
Below is what I did.

Codes in delete button_click:

If IsValid() Then
            Dim i As Integer = sqldsUnit.Delete()
            If i > 0 Then
                Response.Redirect("Unit_Main.aspx?village=" & Request.QueryString("village"))
            Else
                ltrlError.Text = "Error deleting record. Please try again."
            End If
        End If

Simple delete command inside sqldatasource with its delete parameter:

DeleteCommand="delete from unit where unitid=@unitid"

<DeleteParameters>
            <asp:QueryStringParameter QueryStringField="id" Name="unitid" />
        </DeleteParameters>

Is there anything that I did wrong ?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.