SqlDataSource UpdateCommand plus Insert

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • renatois
    New Member
    • Oct 2007
    • 16

    #1

    SqlDataSource UpdateCommand plus Insert

    SqlDataSource UpdateCommand plus Insert

    I have a SqlDataSource with an UpdateCommand but besides that i need also an Insert command triggered on the same update command.

    That´s because i need to update a record and at the same time include a log of that update in another database.

    Thanks
  • mikeyeli
    New Member
    • Oct 2007
    • 63

    #2
    Originally posted by renatois
    SqlDataSource UpdateCommand plus Insert

    I have a SqlDataSource with an UpdateCommand but besides that i need also an Insert command triggered on the same update command.

    That´s because i need to update a record and at the same time include a log of that update in another database.

    Thanks
    Dont use an UpdateCommand, use a normal command, where you can use any number of transactions desired.

    Or make a trigger in the DB that makes the insert, makes programming a lot easier if you dont have to worry for such things.

    Comment

    • renatois
      New Member
      • Oct 2007
      • 16

      #3
      Thanks for the reply, but how do I do both options?

      Comment

      • mikeyeli
        New Member
        • Oct 2007
        • 63

        #4
        Originally posted by renatois
        Thanks for the reply, but how do I do both options?
        Option 1, read the following: SqlCommand Class

        Option 2, would basically consist on making a trigger, that whenever there is an insert on some table it "triggers" itself and does whatever you tell it to do.

        To learn to make and use triggers i suggest you google for "Sql Server triggers", or ask any doubts about triggers at the SqlServer forum.

        Comment

        Working...