954,593 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

SQLDataSource Delete()

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.

challenger
Newbie Poster
7 posts since Jun 2006
Reputation Points: 10
Solved Threads: 0
 

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.

hemantksh
Newbie Poster
6 posts since Jun 2007
Reputation Points: 10
Solved Threads: 0
 
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 ?

challenger
Newbie Poster
7 posts since Jun 2006
Reputation Points: 10
Solved Threads: 0
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You