我正在尝试使用该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
怎么了 ?