Hi All!
I'm triing in MFC to insert a string into a database, which 200k is. In the case, when the string is small, it works, but it isn't working, when the string is 200k.
Here is my source code:

CDatabase   db;
rset_ekg    *ekgrs;
Cstring     SQLQuery,cbuff;

if(db.OpenEx(_T("DSN=dsn_name;UID=user_id; PWD=passw"), CDatabase::noOdbcDialog )!=0)
{



        SQLQuery = "SELECT * FROM EKGEREDM WHERE TenyID=";
    SQLQuery += "15";

    ekgrs = new rset_ekg(&db);
    ekgrs->Open(CRecordset::snapshot,SQLQuery,CRecordset::executeDirect);
    ekgrs->MoveFirst();
    ekgrs->Edit();
        ekgrs->m_EKGXML=cbuff;   //cbuff is a Cstring containing 200k data
        ekgrs->SetFieldDirty(&ekgrs->m_EKGXML);
    ekgrs->SetFieldNull(&ekgrs->m_EKGXML,FALSE);
    ekgrs->Update();
    ekgrs->Close();
    delete ekgrs;
}

and the rset_ekg is the fallowing:

// rset_ekg recordset

class rset_ekg : public CRecordset
{
public:
    rset_ekg(CDatabase* pDatabase = NULL);
    DECLARE_DYNAMIC(rset_ekg)
    CString m_TENYID;
    CTime   m_DATUM;
    CString m_MINTAVETEL;
    CLongBinary m_EKGSCP;
    CString m_EKGXML;
    //}}AFX_FIELD


// Overrides
    // ClassWizard generated virtual function overrides
    //{{AFX_VIRTUAL(rset_ekgeredm)
    public:

    virtual void DoFieldExchange(CFieldExchange* pFX);  // RFX support
    //}}AFX_VIRTUAL

};

// rset_ekg.cpp : implementation file
//

#include "stdafx.h"
#include "rset_ekg.h"
#include "afxcoll.h"


/////////////////////////////////////////////////////////////////////////////
// rset_ekg

IMPLEMENT_DYNAMIC(rset_ekg, CRecordset)

rset_ekg::rset_ekg(CDatabase* pdb)
    : CRecordset(pdb)
{
    //{{AFX_FIELD_INIT(rset_ekg)
    m_TENYID = _T("");

    m_nFields = 5;
    //}}AFX_FIELD_INIT
    m_nDefaultType = snapshot;
}



void rset_ekg::DoFieldExchange(CFieldExchange* pFX)
{
    //{{AFX_FIELD_MAP(rset_ekg)
    pFX->SetFieldType(CFieldExchange::outputColumn);
    RFX_Text(pFX, _T("[TENYID]"), m_TENYID);
    RFX_Date(pFX, _T("[DATUM]"), m_DATUM);
    RFX_Text(pFX, _T("[MINTAVETEL]"), m_MINTAVETEL);
    RFX_LongBinary(pFX, _T("[EKGSCP]"), m_EKGSCP);
    RFX_Text(pFX, _T("[EKGXML]"), m_EKGXML);
    //}}AFX_FIELD_MAP
}

The type of the field is CLOB in the database. So, I get a failure notice, and there is in the field one character..

Thanks

Member Avatar for iamthwee

Eeeek, that MFC gives me the creepies. :sad:

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.