BLOBs Problem 
Author Message
 BLOBs Problem

Hello!!!

I have a BLOB's problem maybe someone can help me.

I'm tring to add new recordset to DB with AddNew(). two fields in this
recordset are BLOBs (CLongBinary).
the problem is that the information that gets to the DB is wrong: the
second blob field gets the first blob
field information.
the m_hData field of the CLongBinary holds the right information but in the
DB it's Wrong.

i'm using:
Visual C++ 4.1
ODBC
Sybase DB

Thanks Hagit.



Sat, 26 Jun 1999 03:00:00 GMT  
 BLOBs Problem

With blobs it is important to call SetFieldDirty() and
SetFieldNull before the call to Update(), ie:  
        .
        .
        .
        Recordset.AddNew();

        Recordset.TheBlob.m_dwDataLength = DataLength;
        Recordset.TheBlob.m_hData = hData;
        Recordset.SetFieldNull( &Recordset.TheBlob, FALSE );
        Recordset.SetFieldDirty( &Recordset.TheBlob );

        Recordset.Update();
        Recordset.Close();
        .
        .
        .

hope this helps.


says...

Quote:

>Hello!!!

>I have a BLOB's problem maybe someone can help me.

>I'm tring to add new recordset to DB with AddNew(). two fields in this
>recordset are BLOBs (CLongBinary).
>the problem is that the information that gets to the DB is wrong: the
>second blob field gets the first blob
>field information.
>the m_hData field of the CLongBinary holds the right information but in the
>DB it's Wrong.

>i'm using:
>Visual C++ 4.1
>ODBC
>Sybase DB

>Thanks Hagit.



Sat, 03 Jul 1999 03:00:00 GMT  
 BLOBs Problem

Hello Bob

Thanks for your help but:
I'm using  SetFieldDirty() and SetFieldNull() and it's working when i have
only one BLOB field in the recordset (like in your example). the problem
starts when i use recordset with two BLOBs field. Then the information that
gets to DB is wrong. when i open the DB i see that the second field gets
the first field's information.

i'm doing something like that:

        Recordset.AddNew();

        Recordset.TheFirstBlob.m_dwDataLength = FirstDataLength;
        Recordset.TheFirstBlob.m_hData = FirsthData;
        Recordset.SetFieldNull( &Recordset.TheFirstBlob, FALSE );
        Recordset.SetFieldDirty( &Recordset.TheFirstBlob );

        Recordset.TheSecondBlob.m_dwDataLength = SecondDataLength;
        Recordset.TheSecondBlob.m_hData = SecondhData;
        Recordset.SetFieldNull( &Recordset.TheSecondBlob, FALSE );
        Recordset.SetFieldDirty( &Recordset.TheSecondBlob );

        Recordset.Update();
        Recordset.Close();

the m_hData gets the right information, but in DB it's wrong.
maybe u can help me with that.
Thanks alot
Hagit



Quote:
> With blobs it is important to call SetFieldDirty() and
> SetFieldNull before the call to Update(), ie:      
>    .
>    .
>    .
>    Recordset.AddNew();

>    Recordset.TheBlob.m_dwDataLength = DataLength;
>    Recordset.TheBlob.m_hData = hData;
>    Recordset.SetFieldNull( &Recordset.TheBlob, FALSE );
>    Recordset.SetFieldDirty( &Recordset.TheBlob );

>    Recordset.Update();
>    Recordset.Close();
>    .
>    .
>    .

> hope this helps.


> says...

> >Hello!!!

> >I have a BLOB's problem maybe someone can help me.

> >I'm tring to add new recordset to DB with AddNew(). two fields in this
> >recordset are BLOBs (CLongBinary).
> >the problem is that the information that gets to the DB is wrong: the
> >second blob field gets the first blob
> >field information.
> >the m_hData field of the CLongBinary holds the right information but in
the
> >DB it's Wrong.

> >i'm using:
> >Visual C++ 4.1
> >ODBC
> >Sybase DB

> >Thanks Hagit.



Sat, 03 Jul 1999 03:00:00 GMT  
 BLOBs Problem

I've been advised that ODBC or CRecordset will only work with one
"unbound" field per record. A BLOB is and example of an unbound
field.  Unbound means that the one chunk of memory is not
preallocated and used for all read/write operations.  Also, the
unbound field should be the last field in the record (Oracle and
SQL Server can be picky about this).

Quote:

> Hello Bob

> Thanks for your help but:
> I'm using  SetFieldDirty() and SetFieldNull() and it's working when i have
> only one BLOB field in the recordset (like in your example). the problem
> starts when i use recordset with two BLOBs field. Then the information that
> gets to DB is wrong. when i open the DB i see that the second field gets
> the first field's information.

> i'm doing something like that:

_________________________
Doug Brockelbank

(8610)6435-9318


Fri, 09 Jul 1999 03:00:00 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. Interesting Blob problem

2. CRecordset and TEXT Blob problem...HELP!

3. BLOB problem

4. BLOB problem

5. BLOB Data fetching problem

6. Problem writing to BLOB coloumns using DBTYPE_BYTES

7. Problem in using ICommand::Execute with BLOB

8. Problem getting BLOBS

9. BLOB dataTypes Problem

10. Problem: MyODBC3.51 + VC6 + BLOB + CLongBinary

11. BLOB data type Problem

12. BLOB's Problem

 

 
Powered by phpBB® Forum Software