H
Houssem12
Guest
i have a problem facing when i make a query with vb.net
Dim cmd As New SqlCommand("select [DO_Piece] from [DL_Ligne_Table] where Numero='" & Label12.Text & "' order by numseq", cn)
Dim dab As SqlDataReader = cmd.ExecuteReader
For i = 0 To dt1.Rows.Count - 1
dab.Read()
If dab.HasRows Then
dt1.Rows(i).Item("Numero") = dab(0)
Else
dt1.Rows(i).Item("Numero") = Label12.Text
End If
Next
in sql server the query work fine and i get a result in vb.net not working at all the error that i get is
'Invalid read attempt when no data is present '
and in sql server i have data present
what i can do please help
Continue reading...
Dim cmd As New SqlCommand("select [DO_Piece] from [DL_Ligne_Table] where Numero='" & Label12.Text & "' order by numseq", cn)
Dim dab As SqlDataReader = cmd.ExecuteReader
For i = 0 To dt1.Rows.Count - 1
dab.Read()
If dab.HasRows Then
dt1.Rows(i).Item("Numero") = dab(0)
Else
dt1.Rows(i).Item("Numero") = Label12.Text
End If
Next
in sql server the query work fine and i get a result in vb.net not working at all the error that i get is
'Invalid read attempt when no data is present '
and in sql server i have data present
what i can do please help
Continue reading...