我正在尝试使用insert
命令在数据库中添加一行。
它成功添加了行,但执行命令后删除了数据库中的旧行!
Dim connetionString As String
Dim cnn As SqlConnection
Dim cmd As SqlCommand
Dim sql As String
connetionString = "Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\Datab1.mdf;Integrated Security=True;User Instance=True"
sql = "INSERT INTO Table1 VALUES ('e', 'e')"
cnn = New SqlConnection(connetionString)
Try
cnn.Open()
cmd = New SqlCommand(sql, cnn)
cmd.ExecuteNonQuery()
cmd.Dispose()
cnn.Close()
MsgBox(" ExecuteNonQuery in SqlCommand executed !!")
Catch ex As Exception
MsgBox(ex.Message)
End Try
有什么问题?
答案 0 :(得分:1)
找到在此表上创建的触发器,该触发器将导致删除旧行。
如果您想快速列出数据库中包含触发器的表,请按以下步骤操作:
USE [YourDB]
SELECT
OBJECT_NAME(parent_id) AS TableName,
name AS TriggerName,
create_date AS CreationDate,
modify_date AS ModifyDate
FROM sys.triggers