目前正在尝试把字符串处理后,添加到ACCESS数据库的二进制字段中去,然后读出来还原。但目前还找不到头绪,因为是两个程序同时操作,但另一个是VC的,也就是说要做到同样的效果。请大家提个建议。VC代码如下:
try
{
pBuffer = new char[strEncryptedCoutent.GetLength()];
pbuffer = &pBuffer[0];
memcpy(pbuffer,strEncryptedCoutent.GetBuffer(strEncryptedCoutent.GetLength()),strEncryptedCoutent.GetLength());
strEncryptedCoutent.ReleaseBuffer(strEncryptedCoutent.GetLength()); rst->Open(_bstr_t(strSQL), m_pDbCon.GetInterfacePtr(), adOpenDynamic, adLockOptimistic, adCmdText);
rst->AddNew();
rst->PutCollect("theTime",(_variant_t)nowtime.Format("%Y-%m-%d %H:%M:%S"));
rst->PutCollect("KeyName",(_variant_t)"1111111");
rst->PutCollect("TypeID",(long)nTypeID);
if(pbuffer)
{
rgsabound[0].lLbound = 0;
rgsabound[0].cElements = strEncryptedCoutent.GetLength();
psy = SafeArrayCreate(VT_UI1,1,rgsabound);
for(long i=0;i<long(strEncryptedCoutent.GetLength());i++)
{
SafeArrayPutElement(psy,&i,pbuffer++);
}
varBLOB.vt = VT_ARRAY | VT_UI1;
varBLOB.parray = psy;
rst->GetFields()->GetItem("EventContent")->AppendChunk(varBLOB);
}
rst->Update();
try
{
pBuffer = new char[strEncryptedCoutent.GetLength()];
pbuffer = &pBuffer[0];
memcpy(pbuffer,strEncryptedCoutent.GetBuffer(strEncryptedCoutent.GetLength()),strEncryptedCoutent.GetLength());
strEncryptedCoutent.ReleaseBuffer(strEncryptedCoutent.GetLength()); rst->Open(_bstr_t(strSQL), m_pDbCon.GetInterfacePtr(), adOpenDynamic, adLockOptimistic, adCmdText);
rst->AddNew();
rst->PutCollect("theTime",(_variant_t)nowtime.Format("%Y-%m-%d %H:%M:%S"));
rst->PutCollect("KeyName",(_variant_t)"1111111");
rst->PutCollect("TypeID",(long)nTypeID);
if(pbuffer)
{
rgsabound[0].lLbound = 0;
rgsabound[0].cElements = strEncryptedCoutent.GetLength();
psy = SafeArrayCreate(VT_UI1,1,rgsabound);
for(long i=0;i<long(strEncryptedCoutent.GetLength());i++)
{
SafeArrayPutElement(psy,&i,pbuffer++);
}
varBLOB.vt = VT_ARRAY | VT_UI1;
varBLOB.parray = psy;
rst->GetFields()->GetItem("EventContent")->AppendChunk(varBLOB);
}
rst->Update();
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货