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

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

am 13.09.2004 05:35:10 von bjorn

------=_NextPart_000_0009_01C49953.6FC6A080
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

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?=20

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

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

If I in my code check following =3D If Not =
IsDBNull(myReader(KolonneIndex)) =3D 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)) =3D True Then
Try
Try
If myReader.GetFieldType(KolonneIndex).ToString =3D "System.Byte[]" Then
Dim Buffer(myReader.GetBytes(KolonneIndex, 0, Nothing, 0, =
Integer.MaxValue) - 1) As Byte=20
myReader.GetBytes(KolonneIndex, 0, Buffer, 0, Buffer.Length)
Dim MemoryBuffer As New MemoryStream(Buffer)
Billede =3D 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=F8rn B=E6kkegaard


------=_NextPart_000_0009_01C49953.6FC6A080--

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

am 13.09.2004 06:15:23 von Paul Coldrey

Hi Bjorn,

If you want the MySQL guys to look at this then you will need to send them a database fragment and a complete code fragment which lets them repeat the bug. There is an FTP site where you can upload larger files - I couldn't find any reference to it on the website but I think it is support.mysql.com with username Anonymous and your email address as a password (from memory you can put things in the /pub/mysql/secret directory).

With regards to your problem, it might be interesting to check whether you get the same behaviour if you change the line:

If Not IsDBNull(myReader(KolonneIndex)) = True Then

to:

If Not myReader(KolonneIndex) Is System.DBNull.Value Then


Cheers,

Paul


Bjørn Baekkegaard wrote:

>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
>
>
>
>



--
MySQL Bugs Mailing List
For list archives: http://lists.mysql.com/bugs
To unsubscribe: http://lists.mysql.com/bugs?unsub=gcdmb-bugs@m.gmane.org