Maybe a bug in IsDBNull() , in ADO.NET driver for MySQL

Bjørn Baekkegaard <[email protected]> Mon, 13 Sep 2004 05:35:10 +0200
Newsgroups gmane.comp.db.mysql.bugs
Message-ID <000c01c49942$ac9602a0$3201a8c0@bb>
Hello Bug-List

Im writing to this list, but im not sure if this is the right way. If not, im sorry using this list. My intenions were not to be rude. If this was the wrong place to go, Is it possible for someone to help me telling where to go? 

I have big problems using the MySQLreader for VB.NET. 

I am trying to read out an image for my MySQL database.

If I in my code check following = If Not IsDBNull(myReader(KolonneIndex)) = True Then ........... then I get an exception "Source array was not long enough. Check srcIndex and length, and the array's lower bounds"
If I execute the same code, without checking if the field is empty, then it works 100%

Is there an bug using IsDBNull() as i do ??


The whole part of the code is as follows:
While myReader.Read()
If Not IsDBNull(myReader(KolonneIndex)) = True Then
Try
Try
If myReader.GetFieldType(KolonneIndex).ToString = "System.Byte[]" Then
Dim Buffer(myReader.GetBytes(KolonneIndex, 0, Nothing, 0, Integer.MaxValue) - 1) As Byte 
myReader.GetBytes(KolonneIndex, 0, Buffer, 0, Buffer.Length)
Dim MemoryBuffer As New MemoryStream(Buffer)
Billede = Billede.FromStream(MemoryBuffer)
myReader.Close()
Return Billede
End If
Catch exp As Exception
MsgBox(exp.Message)
End Try
Catch exp As System.InvalidCastException
MsgBox(exp.Message)
End Try
End If
End While
myReader.Close()

Looking forward to hear from you!

Kind regards
Bjørn Bækkegaard