是否可以在按钮单击
上启用或禁用C#中的sqlserver触发器private void button1_Click(object sender, EventArgs e)
{
try
{
string connectionString = @"Data Source=ABC-SERVER;Initial Catalog=TESTCO;Persist Security Info=True;User ID=sa;Password=password";
using (SqlConnection conn =
new SqlConnection(connectionString))
{
conn.Open();
using (SqlCommand cmd =new SqlCommand("DISABLE TRIGGER [dbo].[MSETUP] ON [dbo].[parts] ", conn))
{
int rows = cmd.ExecuteNonQuery();
}
}
}
catch (SqlException ex)
{
MessageBox.Show(ex.Message);
}
}
如何从C#或任何建议中获取此功能?