G
Guest
Hi,
i try to execute a DDE command with an SQlClientSQLCommen object and i
obtain "syntax error near "Then" ":
dim sql as string
sql = "CREATE TRIGGER myTrigger " & _
"ON MyTable " & _
"AFTER(UPDATE) " & _
"AS " & _
"BEGIN " & _
"SET NOCOUNT ON; " & _
"If UPDATE(Myfield) Then " & _
"BEGIN " & _
"UPDATE MyTable SET MyOtherField=1 WHERE myID IN (SELECT myID from INSERTED)
" & _
"END " & _
"END"
dim oCmd as new sqlClient.SqlCommand(sql,MyConnection)
oCmd.CommandText = sql
oCmd.ExecuteNonQuery()
So, is my syntax incorrect ? (this request works well in a query analyzer)
Best regards,
i try to execute a DDE command with an SQlClientSQLCommen object and i
obtain "syntax error near "Then" ":
dim sql as string
sql = "CREATE TRIGGER myTrigger " & _
"ON MyTable " & _
"AFTER(UPDATE) " & _
"AS " & _
"BEGIN " & _
"SET NOCOUNT ON; " & _
"If UPDATE(Myfield) Then " & _
"BEGIN " & _
"UPDATE MyTable SET MyOtherField=1 WHERE myID IN (SELECT myID from INSERTED)
" & _
"END " & _
"END"
dim oCmd as new sqlClient.SqlCommand(sql,MyConnection)
oCmd.CommandText = sql
oCmd.ExecuteNonQuery()
So, is my syntax incorrect ? (this request works well in a query analyzer)
Best regards,