我对DB和VB.NET有问题。 我们执行一个包含很多行的SELECT,并且在主要时候,我尝试在同一张表中执行INSERT / UPDATE查询,但不在同一行中执行该查询锁定。
这是我的代码:
Using cnn As New SqlConnection(config.connectionString), cmd As New SqlCommand(query, cnn)
Try
cnn.Open()
i = -1
Using reader = cmd.ExecuteReader() ''''
Do While reader.Read()
i += 1
ReDim Preserve radm(i)
radm(i) = New RequestAddEntity
With radm(i)
.type = task.type
.external_id = reader.Item(task.key)
.entity_name = task.entity
.contents = Serialize(reader)
End With
If i + 1 = config.BufferSize Then
api.addEntities(radm, azienda)
i = -1
End If
Loop
End Using
Catch ex As Exception
Logger.Trace("Errore execTask(" & task.entity & ") con eccezione: " & ex.Message)
End Try
End Using
您能告诉我是否有某种方式可以阻止它?
谢谢