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

trigger example???

Hi

i m working with ASP.Net, C#

i need to have an example of trigger

how to call it from C#, and how to execute???

u4umang2001
Light Poster
28 posts since Nov 2007
Reputation Points: 10
Solved Threads: 0
 

what kind of trigger do you mean?

serkan sendur
Postaholic
Banned
2,062 posts since Jan 2008
Reputation Points: 854
Solved Threads: 127
 

sql trigger

u4umang2001
Light Poster
28 posts since Nov 2007
Reputation Points: 10
Solved Threads: 0
 

you dont call a trigger from asp.net, sql trigger is constructed in sql server and it listens for the changes in the specified table(updates, deletes, inserts) .If specified table is modified, then trigger do some changes according to what it is told to.
take this for an example : you have related tables, when the parent table row is deleted you want to delete all the childrows of that parent row, then you specify a trigger for the parent table and tell it to delete all the records in the corresponding child table when a row deleted from the parent table.

serkan sendur
Postaholic
Banned
2,062 posts since Jan 2008
Reputation Points: 854
Solved Threads: 127
 

Read up on Primary keys and Foreign keys. This is how you relate the tables together with a trigger to delete all childrows or update all childrows when the parent row is modified or deleted. This is all done on the server, so if you wish for an explanation of triggers, please visit the MS SQL portion of this site at: http://www.daniweb.com/forums/forum127.html

SheSaidImaPregy
Veteran Poster
1,080 posts since Sep 2007
Reputation Points: 43
Solved Threads: 68
 

Hi

i m working with ASP.Net, C#

i need to have an example of trigger

how to call it from C#, and how to execute???

Hi u4umang2001,
Just check this link, which contains good article. Hope this will help you. http://www.c-sharpcorner.com/UploadFile/pk_khuman/ManagedTrigersUsingCSharp02202007230729PM/ManagedTrigersUsingCSharp.aspx

Thanks & Regards
Dilip Kumar Vishwakarma
Programmer

dilipv
Light Poster
30 posts since Feb 2008
Reputation Points: 10
Solved Threads: 4
 

hi i want example for trigger

naveen.k
Newbie Poster
1 post since Jun 2011
Reputation Points: 10
Solved Threads: 0
 

{CREATE | RECREATE | CREATE OR ALTER} TRIGGER name FOR {TABLE name | VIEW name}
[ACTIVE | INACTIVE]
{BEFORE | AFTER}
{INSERT [OR UPDATE] [OR DELETE] | UPDATE [OR INSERT] [OR DELETE] | DELETE [OR UPDATE] [OR INSERT] }
[POSITION n] AS
BEGIN
.....
END
This is one of the example of firing the trigger

shiva07
Light Poster
37 posts since Jun 2011
Reputation Points: 13
Solved Threads: 4
 
matricol
Junior Poster in Training
98 posts since Jun 2011
Reputation Points: 2
Solved Threads: 9
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You