Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

Binary field in SQL Server

Posted on 2005-04-11
8
Medium Priority
?
624 Views
Last Modified: 2013-11-20
Hi,

I'm using CRecordset to open a SQL server table through ODBC. I have encountered a problem with  a binary field. The binary data retrieved will always be different from what I have added to the table. I have added the CRecordset using the "insert new class" and the variable type of the field is CByteArray.  Is there anything wrong with this?  The codes generate in the DoFieldExchange function is :

RFX_Binary(pFX, _T("[Data]"), m_Data);

Thanks.
0
Comment
Question by:xstar
  • 3
  • 2
6 Comments
 
LVL 30

Expert Comment

by:Axter
ID: 13751630
>>RFX_Binary(pFX, _T("[Data]"), m_Data);

You don't have a max size.

Example:
RFX_Binary(pFX, _T("[Image]"), m_Image, 8000000);
0
 
LVL 30

Expert Comment

by:Axter
ID: 13751639
Please also show your *.h file declaration of m_Data within your CRecordset derived class.

And can you show how you're using it.
0
 

Author Comment

by:xstar
ID: 13758537
CByteArray      m_Data;

I have added in the max size but I still cannot get back the correct data.
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 

Author Comment

by:xstar
ID: 13758938
Hi,

I finally get back the correct data.

Previous when adding of new record to database, I have tried to :
m_Data.RemoveAll(); //clear all objects
m_Data.Add(1); //add until the max length(10)
.....

This does not work so I try with :
m_Data.SetSize(10);
m_Data[0] = 1;
..........

This works fine.  Isn't adding and setting size the same as long as the final array size is 10?

0
 
LVL 30

Expert Comment

by:Axter
ID: 13759026
>>Isn't adding and setting size the same as long as the final array size is 10?

It should be the same.  I'm not sure why it would fail using first method.
0
 

Accepted Solution

by:
GranMod earned 0 total points
ID: 16368753
PAQed with points refunded (50)

GranMod
Community Support Moderator
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction: Load and Save to file, Document-View interaction inside the SDI. Continuing from the second article about sudoku.   Open the project in visual studio. From the class view select CSudokuDoc and double click to open the header …
Introduction: The undo support, implementing a stack. Continuing from the eigth article about sudoku.   We need a mechanism to keep track of the digits entered so as to implement an undo mechanism.  This should be a ‘Last In First Out’ collec…
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
Look below the covers at a subform control , and the form that is inside it. Explore properties and see how easy it is to aggregate, get statistics, and synchronize results for your data. A Microsoft Access subform is used to show relevant calcul…
Suggested Courses
Course of the Month11 days, 13 hours left to enroll

564 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question