0
arasında donuyor Veri tablosundan en yakın değeri bulmak için bu kodu kullanıyorum. Uygulama Döngü
For Each row As DataGridViewRow In DataGridView2.Rows
ToolStripProgressBar1.Value = ToolStripProgressBar1.Value + 1
f = 0
Using dbconnn As New OleDbConnection(connString)
dbconnn.Open()
While f <> 1
Dim query1 As String = "Select [Alloted_Operator], [Avg_Eff] from ASkill_Matrix2 where [Operation_Type] = '" & row.Cells("Operation_Type").Value & "' and [Avg_Eff] between " & Double.Parse(row.Cells("Req_perf").Value - a) & " and " & Double.Parse(row.Cells("Req_perf").Value + a) & " and [Alloted_Operator] not in (select All_Opr from A) "
Using cmd As New OleDbCommand(query1, dbconnn)
Using reader1 = cmd.ExecuteReader
'If reader1.HasRows Then
If reader1.Read() Then
f = 1
'MessageBox.Show(i)
row.Cells("All_Opr").Value = reader1.GetValue(0)
row.Cells("Opr_Eff").Value = reader1.GetValue(1)
row.Cells("Exp_Prod").Value = Convert.ToDouble((60 * row.Cells("Opr_Eff").Value)/(row.Cells("Oprn_SAM").Value * 100))
row.Cells("Balance").Value = Convert.ToInt64(row.Cells("Exp_Prod").Value - Convert.ToInt64(Label1.Text))
row.Cells("Rem_Eff").Value = Convert.ToInt64(row.Cells("Opr_Eff").Value - row.Cells("Req_perf").Value)
Dim query29 As String = "insert into A ([Machine_Type], [Attatchment], [All_Opr]) Values ('" & CStr(row.Cells("Machine_Type").Value) & "', '" & CStr(row.Cells("Attatchment").Value) & "', '" & CStr(row.Cells("All_Opr").Value) & "')"
Using cmd1 As New OleDbCommand(query29, dbconnn)
cmd1.ExecuteNonQuery()
End Using
If row.Cells("Rem_Eff").Value >= 20 Then
Dim query3 As String = "insert into Temp_Av_Opr ([Machine_Type], [Attatchment], [All_Opr],[Opr_Eff]) Values ('" & CStr(row.Cells("Machine_Type").Value) & "','" & CStr(row.Cells("Attatchment").Value) & "', '" & CStr(row.Cells("All_Opr").Value) & "', '" & CStr(row.Cells("Rem_Eff").Value) & "')"
Using cmd2 As New OleDbCommand(query3, dbconnn)
cmd2.ExecuteNonQuery()
End Using
End If
Else
a += 1
End If
End Using
End Using
End While
End Using
Next
bu
bu bana yardım edin ya plz bana aynı şeyi başka bir yöntem önermek ikinci kaçak benim pencere uygulaması donuyor. döngü önce satır kadar kullanmayan ilk döngü içindeki herhangi bir şeye ( DBConn aslında ) taşımak için You yapmak