Results 1 to 2 of 2
  1. #1
    Join Date
    Jun 2008
    Posts
    2

    Unanswered: data truncated problem when fetching using MFC CRecordset

    Hello,
    I am using PostgreSQL 8.2 and programming using VC++ MFC.
    I have a field in a table of type text and it is for storing xml file.
    I am using ODBC to access the PostgreSQL database.
    I have no problem inserting the data in but when it comes to fetching, I will get an error: data truncated.

    In VC++:
    CString m_cleaned_xml;
    m_cleaned_xml.GetBufferSetLength(256000);
    m_cleaned_xml.ReleaseBufferSetLength(256000);
    ...
    RFX_Text(pFX, _T("[cleaned_xml]"), m_cleaned_xml, 256000, SQL_LONGVARCHAR);

    In ODBC data source:
    checked "Text as LongVarChar"
    set "Max LongVarChar" to 256000

    Anyone know why it is not working?
    Thanks in advance.
    Hoi
    Attached Thumbnails Attached Thumbnails datasource.JPG  

  2. #2
    Join Date
    Jun 2008
    Posts
    2
    I have managed to get this to work now.
    I need to set in the connection string to have the following:

    MaxLongVarcharSize=256000

    Thanks for all the one who tried to help.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •