|
为何wince数据库在单个记录中无法对单个属性进行连续存储呢?
[复制链接]
像这样先存一个数再存一个字符串,完全可以存储
////////////////////////////////////////////////////////////////////
CEPROPVAL *pRorps;
pRorps = new CEPROPVAL[10000];
//
memset(pRorps,0,sizeof(pRorps));
pRorps->propid = PID_NO;
pRorps->val.lVal =3;
pRorps++;
memset(pRorps,0,sizeof(pRorps));
pRorps->propid = PID_PASSWORD;
pRorps->val.lpwstr = TEXT("PENG1");
pRorps++;
memset(pRorps,0,sizeof(pRorps));
pRorps->propid = PID_NO;
pRorps->val.lVal =4;
pRorps++;
memset(pRorps,0,sizeof(pRorps));
pRorps->propid = PID_PASSWORD;
pRorps->val.lpwstr = TEXT("PENG2");
pRorps++;
memset(pRorps,0,sizeof(pRorps));
pRorps->propid = PID_NO;
pRorps->val.lVal =6;
pRorps++;
memset(pRorps,0,sizeof(pRorps));
pRorps->propid = PID_PASSWORD;
pRorps->val.lpwstr = TEXT("PENG3");
pRorps++;
memset(pRorps,0,sizeof(pRorps));
pRorps->propid = PID_NO;
pRorps->val.lVal =6;
pRorps++;
memset(pRorps,0,sizeof(pRorps));
pRorps->propid = PID_PASSWORD;
pRorps->val.lpwstr = TEXT("PENG3");
pRorps++;
memset(pRorps,0,sizeof(pRorps));
pRorps->propid = PID_NO;
pRorps->val.lVal =6;
pRorps++;
memset(pRorps,0,sizeof(pRorps));
pRorps->propid = PID_PASSWORD;
pRorps->val.lpwstr = TEXT("PENG3");
pRorps++;
memset(pRorps,0,sizeof(pRorps));
pRorps->propid = PID_NO;
pRorps->val.lVal =6;
pRorps++;
memset(pRorps,0,sizeof(pRorps));
pRorps->propid = PID_PASSWORD;
pRorps->val.lpwstr = TEXT("PENG3");
pRorps-=11;
oid =0;
oid = CeWriteRecordProps(m_hdb, //已打开数据库句柄
0, //为0,则创建新记录
12, //属性ID结构数组中项目的数量
pRorps);
///////////////////////////////////////////////////////////////////////////
但是要是像下面这样存储,在读取时就会出现致命错误,怎么回事呢
///////////////////////////////////////////////////////////////////////////
CEPROPVAL *pRorps;
pRorps = new CEPROPVAL[10000];
//
memset(pRorps,0,sizeof(pRorps));
pRorps->propid = PID_NO;
pRorps->val.lVal =3;
pRorps++;
memset(pRorps,0,sizeof(pRorps));
pRorps->propid = PID_NO;
pRorps->val.lVal =4;
pRorps++;
memset(pRorps,0,sizeof(pRorps));
pRorps->propid = PID_NO;
pRorps->val.lVal =6;
pRorps-=2;
oid =0;
oid = CeWriteRecordProps(m_hdb, //已打开数据库句柄
0, //为0,则创建新记录
3, //属性ID结构数组中项目的数量
pRorps); //要记录的东东
///////////////////////////////////////////////////////////////////////////
|
|