List:MySQL and .NET« Previous MessageNext Message »
From:Tobias Schittkowski Date:October 25 2004 2:54pm
Subject:ArgumentOutOfRangeException in reader.GetBytes?
View as plain text  
Hi!
I am trying to load a BLOB from the DB, but I get an exception:
non-negative number required for count

   at System.IO.BufferedStream.Read(Byte[] array, Int32 offset, Int32 count)
   at MySql.Data.MySqlClient.PacketReader.Read(Byte[]& buffer, Int64 pos,
Int64 len)
   at MySql.Data.Types.MySqlBinary.SetData(PacketReader reader, Int64
length)
   at MySql.Data.MySqlClient.NativeDriver.ReadFieldValue(Int32 index,
MySqlField field, MySqlValue valObject)
   at MySql.Data.MySqlClient.CommandResult.get_Item(Int32 index)
   at MySql.Data.MySqlClient.MySqlDataReader.GetBytes(Int32 i, Int64
dataIndex, Byte[] buffer, Int32 bufferIndex, Int32 length)

Here is a code snippet:

      	Do While reader.Read()
                startIndex = 0
                retval = reader.GetBytes(0, startIndex, outbyte, 0,
bufferSize)
                Do While retval = bufferSize
                    startIndex += bufferSize
                    retval = reader.GetBytes(0, startIndex, outbyte, 0,
bufferSize)
                Loop
            Loop

Buffersize is 1024, outbyte is Byte() with length 1024.
I am using the current bitkeeper version of connector.net

Tobias
  

                      \|||/
--------------0oo----( o o )----oo0---------
                       (_)
    Tobias Schittkowski
    ESF Softwaredienste GmbH & Co. KG
    Albert-Einstein-Ring 37
    D-95448 Bayreuth
    Tel. 0049 (0)921 7931613
    Mobil 0049 (0)170 7505443

--------------------------------------------
    

Thread
ArgumentOutOfRangeException in reader.GetBytes?Tobias Schittkowski25 Oct