I have a "thinking" problem...
I use your latest Building of mySQLDirect.NET with the following code:
Code: Select all
Me.Cursor = Cursors.WaitCursor
Dim myDataReader As CoreLab.MySql.MySqlDataReader
mySQLConnection.Open()
mySQLCommand.CommandText = "Select ID, InvNr, Lieferant, ArtikelNr, " & _
"Groesse, Farbe, ArtBez, VPreis, DivArt, iCode " & _
"From ArtikelStamm Where " & _
"InvNr = '" & txtInvNr.Text & "' and " & _
"Lieferant = " & txtLieferant.Text & " and " & _
"ArtikelNr = '" & txtArtNummer.Text & "'"
mySQLCommand.Connection = mySQLConnection
myDatareader = mySQLCommand.ExecuteReader
Me.Cursor = Cursors.Default
' OK - Till here, everything works fine
If myDatareader.Read = True Then
' Here should each record be checked
For i As Integer = 1 To myDataReader.ResultCount
' If the Item "DivArt" or the Item "Groesse" & Item "Farbe" are the same as in the textboxes, - the correct Record was found
If Val(myDataReader.Item("DivArt")) = 1 Then Exit For
If myDataReader.Item("Groesse") = txtGroesse.Text And _
myDataReader.Item("Farbe") = txtFarbe.Text Then
Exit For
End If
myDataReader.NextResult()
Next
'If the end of the Data Reader is reached, that does the record(s) not match - an error should appear - or when the Data Reader has not reached the end - the data should be displayed.
' But here I am doing soemthing wrong i think, because here I always get false, also when the data exists...
If myDataReader.Read = False Then
MsgBox("Kein Artikel gefunden!", MsgBoxStyle.Information, _
"Keinen Artikel gefunden...")
mySQLConnection.Close()
Exit Sub
End If
txtInvNr.Text = myDatareader.Item("InvNr").ToString
txtLieferant.Text = myDatareader.Item("Lieferant").ToString
THX!