hello guys![]()
i just wanted to ask how can i create triggers from code using VB6 or anyother version of VB
i made a command and assinged the trigger script to the command but i didnt work out ! it sounds the commands connot exexute T-SQL scripts
i tried to use all cmd.commandtype but non of them succeed .Code:cmd.ActiveConnection = conn cmd.CommandText = strTrigger cmd.Execute
adCmdFile,adCmdStoredProc,adCmdTable,adCmdTableDirect,adCmdTableDirect,adCmdText and adCmdUnknown![]()
i also tried conn.Execute strTrigger![]()
BTW strTrigger string contains the trigger script
but its giving me an error on line 1Code:CREATE TRIGGER [AAA_TR] ON [AAA] FOR INSERT, UPDATE, DELETE AS DECLARE @ID AS VARCHAR(100) bla bla bla ...... etc
" Line 1: Incorrect syntax near 'Begin' "
what i'm doing exactly is trying to make triggers to some tables from code and then droping these triggers
if i execute the script from the query analyzer it works fine, but not from the code
can anybody help please please its urgent![]()
thank you![]()




Reply With Quote