H
Houssem12
Guest
Hi members
i want to check if the record is ixist or not and i tried a lot without a solution
please i want a help oncing for all because i use this a lot in my apps
For b = 0 To DataGridView4.Rows.Count - 1
If cn.State = ConnectionState.Open Then
cn.Close()
End If
cn.Open()
Dim cs55 As New SqlCommand("select count(do_tiers) from F_DOCENTETE where do_type='12' and DO_Piece='" & DataGridView4.Rows(b).Cells(0).Value & "'", cn)
Dim az = cs55.ExecuteScalar
If az = 0 Then
Else
Dim cs555 As New SqlCommand("select do_tiers,do_piece from F_DOCENTETE where do_type='12' and DO_Piece='" & DataGridView4.Rows(b).Cells(0).Value.ToString & "' and DO_Tiers='" & TextBox1.Text & "'", cn)
Dim azz As SqlDataReader = cs555.ExecuteReader
azz.Read()
If azz.HasRows Then
MessageBox.Show("bien" & DataGridView4.Rows(b).Cells(0).Value)
ElseIf Not azz.HasRows Then
MessageBox.Show("fournisseur n'est pas equivalent au Bon Commande !!!" & DataGridView4.Rows(b).Cells(0).Value)
End If
End If
Next
if azz.hasRow work perfectly but in else statement
i maked a messageBox to see what hapen("probably it stepped the row where not equal")
even i maked elseif not azz.hasRow
please help
Continue reading...
i want to check if the record is ixist or not and i tried a lot without a solution
please i want a help oncing for all because i use this a lot in my apps
For b = 0 To DataGridView4.Rows.Count - 1
If cn.State = ConnectionState.Open Then
cn.Close()
End If
cn.Open()
Dim cs55 As New SqlCommand("select count(do_tiers) from F_DOCENTETE where do_type='12' and DO_Piece='" & DataGridView4.Rows(b).Cells(0).Value & "'", cn)
Dim az = cs55.ExecuteScalar
If az = 0 Then
Else
Dim cs555 As New SqlCommand("select do_tiers,do_piece from F_DOCENTETE where do_type='12' and DO_Piece='" & DataGridView4.Rows(b).Cells(0).Value.ToString & "' and DO_Tiers='" & TextBox1.Text & "'", cn)
Dim azz As SqlDataReader = cs555.ExecuteReader
azz.Read()
If azz.HasRows Then
MessageBox.Show("bien" & DataGridView4.Rows(b).Cells(0).Value)
ElseIf Not azz.HasRows Then
MessageBox.Show("fournisseur n'est pas equivalent au Bon Commande !!!" & DataGridView4.Rows(b).Cells(0).Value)
End If
End If
Next
if azz.hasRow work perfectly but in else statement
i maked a messageBox to see what hapen("probably it stepped the row where not equal")
even i maked elseif not azz.hasRow
please help
Continue reading...