我有一个 VB.NET Simple 应用程序,用于在 SQL Server 中创建数据库并创建表。我希望能够从 VB.NET 在 SQL Server 中创建 SQL 触发器。 IE。在 vb.net 中创建触发器语句。我知道如何使用 SQL Management Studio 在代码中创建它。
最佳答案
您可以在vb中的SqlCommand中运行sql代码
Dim sqlConnection1 As New SqlConnection("Your Connection String")
Dim cmd As New SqlCommand
cmd.CommandText = "CREATE TRIGGER trig_Update_Employee etc etc etc"
cmd.CommandType = CommandType.Text
cmd.Connection = sqlConnection1
sqlConnection1.Open()
cmd.ExecuteNonQuery()
sqlConnection1.Close()
关于sql-server - VB.NET 中的 SQL 触发器,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28244449/