我有一个连接到 SQL 2008 服务器的 VB.net CF 应用程序。我正在尝试实现事务,但是当我在事务开始时破坏我的代码时,某些读取查询无法在表上完成。例如,从 id <> 123 的表中选择所有记录不会返回任何值。但是 select * from stock 将返回除我正在处理的行之外的所有值。
Dim SQLComm As Data.SqlClient.SqlCommand
Dim myConnString As String = frmConnectionDetails.GetConnectionString
Dim SQLConn As New SqlConnection(myConnString)
Dim SQLTrans As SqlTransaction
SQLConn.Open()
SQLTrans = SQLConn.BeginTransaction(Data.IsolationLevel.ReadCommitted)
SQLComm = New SqlCommand
SQLComm.Connection = SQLConn
SQLComm.Transaction = SQLTrans
AddOrUpdateStock(objStock, SQLConn, SQLComm)
-Break here