|
这段代码实现添加add和编辑edit功能,编译通过了,但功能无法实现。谢谢帮忙看下!
bool CFinal92Dlg::AddCAR(REC_CAR car)
{
CString str;
SYSTEMTIME systime;
FileTimeToSystemTime(&(car.ftday),&systime);
TCHAR szday[11];
swprintf(szday,_T("%d-%d-%d"),systime.wYear,systime.wMonth,systime.wDay);
int result;
char *ysql="INSERT INTO\"Address_List\" VALUES(NULL,'2009-9-1','123','123','123','123','123'); ";
RETAILMSG(1, (TEXT("%d \n\r\n"),edit));
if(!edit)
{
str="INSERT INTO\"Address_List\" VALUES(NULL,'";
str+=szday;
str+="','";
str+=car.szNo;
str+="','";
str+=car.szLei;
str+="','";
str+=car.szMao;
str+="','";
str+=car.szPi;
str+="','";
str+=car.szJing;
str+="');";
memset( ysql, 0,100);
WideCharToMultiByte( CP_ACP, 0, str, -1, ysql, 100, NULL, NULL); //我感觉是不是这两行这里有问题??
}
else
{
str="UPDATE \"Address_List\" SET ";
str+="DAY='";
str+=szday;
str+="',NO='";
str+=car.szNo;
str+="',LEI='";
str+=car.szLei;
str+="',MAO='";
str+=car.szMao;
str+="',PI='";
str+=car.szPi;
str+="',JING='";
str+=car.szJing;
str+="' where id=";
str+=exchang+";";
ysql = "UPDATE \"Address_List\" SET DAY='2009-9-2',NO='123',LEI='123',MAO='123',PI='123',JING='123'where id=4;"; //ID数据段默认自增.
}
str=ysql;
RETAILMSG(1, (TEXT("%s \n\r\n"),str));
result=sqlite3_exec( db , ysql , 0 , 0 , &zErrMsg);
if(result !=SQLITE_OK)
printf("zErrMsg = %s \n", zErrMsg);
OnRefresh();
return true;
}
|
|