bakershawnm
Programmer
Not sure if this is because of threading or what.
Using VS2008 VB.net and SQL server 2005.
I have the following module inside a thread class. The thread is being spawned by a controlling form.
Private Sub BuildBatTag(ByVal infl As StreamReader)
Dim instrng As String
Dim BCAOPScnxn As New ADODB.Connection
Dim BtTgdata As New ADODB.Recordset
Dim x As Integer
BCAOPScnxn.ConnectionString = "Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=False;" & _
"Data Source=KRONOS;Initial Catalog=BCA_Operations"
BCAOPScnxn.Open()
With BtTgdata
.Open("dbo.BatTagData2", BCAOPScnxn, ADODB.CursorTypeEnum.adOpenDynamic, _
ADODB.LockTypeEnum.adLockOptimistic, ADODB.CommandTypeEnum.adCmdTable)
.AddNew()
.Fields("Model").Value = Model
.Fields("Assembly_Part_No").Value = AssyNo
.Fields("Wir_No").Value = WirNo
.Fields("AP_No").Value = Eff
.Fields("ImprtDate").Value = Today()
For x = 1 To 8
instrng = infl.readline()
Select Case x
Case 2
.Fields("Wire_Bundle").Value = Mid(instrng, 2, 14)
.Fields("DCN").Value = Mid(instrng, 16, 2)
Case 5
.Fields("Remarks").Value = Mid(instrng, 62, 20)
Case 6
.Fields("Used_On").Value = Left(instrng, 20)
Case 8
.Fields("Using_Shop").Value = Mid(instrng, 9, 3)
End Select
Next
.Update()
RaiseEvent Prgrsbar(3)
.Close()
End With
BCAOPScnxn.Close()
BCAOPScnxn = Nothing
End Sub
When I step through the code the with a trap at the .Update it will execute this statement (and any subsequent statements and probably previous statements too) twice.
If this is a threading issue how can I solve this? Is it possible that my form is somehow spawning more than one thread?
If it is not a threading issue than what would cause the double execution of the same statements?
Using VS2008 VB.net and SQL server 2005.
I have the following module inside a thread class. The thread is being spawned by a controlling form.
Private Sub BuildBatTag(ByVal infl As StreamReader)
Dim instrng As String
Dim BCAOPScnxn As New ADODB.Connection
Dim BtTgdata As New ADODB.Recordset
Dim x As Integer
BCAOPScnxn.ConnectionString = "Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=False;" & _
"Data Source=KRONOS;Initial Catalog=BCA_Operations"
BCAOPScnxn.Open()
With BtTgdata
.Open("dbo.BatTagData2", BCAOPScnxn, ADODB.CursorTypeEnum.adOpenDynamic, _
ADODB.LockTypeEnum.adLockOptimistic, ADODB.CommandTypeEnum.adCmdTable)
.AddNew()
.Fields("Model").Value = Model
.Fields("Assembly_Part_No").Value = AssyNo
.Fields("Wir_No").Value = WirNo
.Fields("AP_No").Value = Eff
.Fields("ImprtDate").Value = Today()
For x = 1 To 8
instrng = infl.readline()
Select Case x
Case 2
.Fields("Wire_Bundle").Value = Mid(instrng, 2, 14)
.Fields("DCN").Value = Mid(instrng, 16, 2)
Case 5
.Fields("Remarks").Value = Mid(instrng, 62, 20)
Case 6
.Fields("Used_On").Value = Left(instrng, 20)
Case 8
.Fields("Using_Shop").Value = Mid(instrng, 9, 3)
End Select
Next
.Update()
RaiseEvent Prgrsbar(3)
.Close()
End With
BCAOPScnxn.Close()
BCAOPScnxn = Nothing
End Sub
When I step through the code the with a trap at the .Update it will execute this statement (and any subsequent statements and probably previous statements too) twice.
If this is a threading issue how can I solve this? Is it possible that my form is somehow spawning more than one thread?
If it is not a threading issue than what would cause the double execution of the same statements?