Retrieving Sybase Long Binary field value

P

Peter

Hi

I'm converting a project that was written in VS2003 with .NET Framework
1.1 to VS2005 and .NET Framework 2.0. The project is built upon a
Sybase Adaptive Server Anywhere 8.0.1 database which is accessed via
the Sybase OLEDB driver ASAProv.80. Prior to the conversion the
project was working well and is in production.

Part of the code retrieves a scanned signature (of about 32Kb) from the
database that is stored in an array of bytes within a Long Binary
field. The bytes are then converted to an image.

The code used to do this is:

Dim lBlobRdr As OleDb.OleDbDataReader

lBlobRdr = mData.GetDataReader("select fld_data from dba.tbl_param_blob
where fld_setting = 'Signature'")
lBlobRdr.Read()

If lBlobRdr.HasRows Then
Dim lSignature(CInt(lBlobRdr.GetBytes(0, 0, Nothing, 0,
Integer.MaxValue) - 1)) As Byte
lBlobRdr.GetBytes(0, 0, lSignature, 0, lSignature.Length)

lBlobRdr.Close()

The GetDataReader Method called above simply returns an
OLEDBDataReader.

As soon as the OLEDBDataReader.GetBytes method is called the following
exception is thrown and I can't figure out why. Something must have
changed between VS2003/Framework 1.1 and VS2005/Framework 2. I've
tried using a DataTable to retrieve the data but the same Exception
occurs as soon as you try and Fill the DataTable.

07/12/2006 11:07:06, Exception, ''ASAProv.80' failed with no error
message available, result code: DB_E_ERRORSOCCURRED(0x80040E21).' at
System.Data.OleDb.OleDbDataReader.ProcessResults(OleDbHResult hr)
at System.Data.OleDb.OleDbDataReader.GetRowDataFromHandle()
at System.Data.OleDb.OleDbDataReader.GetValueBinding(MetaData info)
at System.Data.OleDb.OleDbDataReader.DoSequentialCheck(Int32
ordinal, Int64 dataIndex, String method)
at System.Data.OleDb.OleDbDataReader.GetBytes(Int32 ordinal, Int64
dataIndex, Byte[] buffer, Int32 bufferIndex, Int32 length)
at CommonObjects_NET.CParameter.RetrieveParam(Param& Parameter)
at AdminModule.rptAdminDocument.get_StandardSignature() in
D:\Work\Courts\Admin Module\Admin4\Documents\rptAdminDocument.vb:line
248

Can someone tell me if there's been changes that would affect the above
code and how I can go about diagnosing what's causing this problem.
Thanks.

Peter,
 
C

ccm682

Did you ever find a solution to this problem? I am seeing the same thing happen on a simple varchar(4000) field and getString on ASAProv.90
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top