کدهای شما خیلی مبهمه . به این صورت امتحان کنید.
If DataGridView1.CurrentRow.Cells(0).Value Then
cmd.CommandText = "insert into shakhes (sal81,sal82,sal83,sal84,sal85,sal86,sal87,sal88,s al89,sal90) VALUES (@a,@b)"
cmd.Parameters.Add("a", SqlDbType.Int, 2)
cmd.Parameters.Add("b", SqlDbType.Int, 2)
For j As Integer = 0 To DataGridView2.RowCount - 1
If DataGridView2.Rows(j).Cells(0).Value Then
a = DataGridView1.CurrentRow.Cells(4).Value / DataGridView2.Rows(j).Cells(4).Value
cmd.Parameters.Item(0).Value = a
cmd.Parameters.Item(1).Value = b
cmd.ExecuteNonQuery()
EndIf
Next
بسته به نیازتون اجرای کوئری رو بیرون یا داخل حلقه انجام بدید .