|
LocalSize(pProps)出了问题
将AddNewStudent 和 EditStudent 改为如下:就ok 了
至于LocalSize(pProps)问题出在何处,及将相应内存初始化注释掉后有什么影响,请自己琢磨吧~~
bool CCEDBUSEDlg::AddNewStudent(REC_STUDENT stu)
{
CEOID ceOid;
CEPROPVAL *pProps;
pProps = new CEPROPVAL[4];
//学生学号
memset(pProps,0,LocalSize(pProps));
pProps->propid = PID_NO;
pProps->val.lpwstr = stu.szNo;
//学生姓名
pProps++;
//memset(pProps,0,LocalSize(pProps));
pProps->propid = PID_NAME;
pProps->val.lpwstr = stu.szName;
//学生出生日期
pProps++;
//memset(pProps,0,LocalSize(pProps));
pProps->propid = PID_BIRTHDAY;
pProps->val.filetime = stu.ftBirthday;
//学生身高
pProps++;
//memset(pProps,0,LocalSize(pProps));
pProps->propid = PID_STATURE;
pProps->val.iVal = stu.iStature;
pProps = pProps -3 ;
ceOid = CeWriteRecordProps(m_hDB,0,4,pProps);
if (ceOid == 0)
{
return false;
}
return true;
}
bool CCEDBUSEDlg::EditStudent(REC_STUDENT stu,CEOID ceOid)
{
CEOID tmpCeOid;
CEPROPVAL *pProps;
pProps = new CEPROPVAL[4];
//学生学号
memset(pProps,0,LocalSize(pProps));
pProps->propid = PID_NO;
pProps->val.lpwstr = stu.szNo;
//学生姓名
pProps++;
//memset(pProps,0,LocalSize(pProps));
pProps->propid = PID_NAME ;
pProps->val.lpwstr = stu.szName;
//学生出生日期
pProps++;
//memset(pProps,0,LocalSize(pProps));
pProps->propid = PID_BIRTHDAY;
pProps->val.filetime = stu.ftBirthday;
//学生身高
pProps++;
//memset(pProps,0,LocalSize(pProps));
pProps->propid = PID_STATURE;
pProps->val.iVal = stu.iStature;
pProps = pProps -3 ;
tmpCeOid = CeWriteRecordProps(m_hDB,ceOid,4,pProps);
if (tmpCeOid == 0)
{
return false;
}
return true;
} |
|