ASP.NET操作SQL的问题
Dim sql As String
Dim myconnection As New SqlClient.SqlConnection()
myconnection = New SqlClient.SqlConnection(stringcon)
Dim mycommand As New SqlClient.SqlCommand(sql, myconnection)
mycommand.Connection.Open()
Dim mytrans As SqlClient.SqlTransaction
mytrans = myconnection.BeginTransaction
Try
sql = "INSERT INTO T (KC) VALUES ('CC00000001')"
mycommand.CommandType = CommandType.Text
mycommand.ExecuteNonQuery()
mytrans.Commit()
Catch
mytrans.Rollback()
Finally
myconnection.Close()
mycommand.Dispose()
myconnection.Dispose()
End Try
它老是不能更新数据库,但那SQL语句是正确的,能在SQL中运行,请各位帮忙