测试ExecuteSQL()函数~ 只要SQLCE语句正确那么就返回TRUE

  1. CStringcsSql3=_T("SELECT*FROMUserTbWHEREuid=123456;");
  2. wicDB.ExecuteSQL(csSql3);
  3. if(wicDB.OpenRecordset(csSql3,1))
  4. {
  5. CStringstrPar=_T("privilege");
  6. result3=wicDB.GetCollect(strPar);
  7. MessageBox(NULL,result3.bstrVal,_T("PASS"),MB_OK);
  8. }
  1. csSql=_T("SELECT*FROMUserTbWHEREuid='1234';");
  2. if(wicDB.ExecuteSQL(csSql))
  3. {
  4. MessageBox(NULL,csSql,_T("PASS"),MB_OK);
  5. }
  6. csSql=_T("SELECT*FROMUserTbWHEREuid='123';");
  7. if(wicDB.ExecuteSQL(csSql))
  8. {
  9. MessageBox(NULL,csSql,_T("PASS"),MB_OK);
  10. }
  11. else
  12. {
  13. MessageBox(NULL,csSql,_T("FAIL"),MB_OK);
  14. }
  15. csSql=_T("SELECT*FROMUserTbWHEREuid='123456';");
  16. if(wicDB.ExecuteSQL(csSql))
  17. {
  18. MessageBox(NULL,csSql,_T("PASS"),MB_OK);
  19. }
  20. 以下的代码是完全OK的~
    1. CDBManagewicDB;
    2. wicDB.OpenDB();//连接数据库
    3. //打开记录集
    4. CStringSqlStr=_T("SELECT*FROMUserTbWHEREuid='123456'");
    5. if(wicDB.OpenRecordset(SqlStr,1))
    6. {
    7. MessageBox(NULL,_T("OpenOK"),_T("OpenRecordset"),MB_OK);
    8. }
    9. else
    10. {
    11. MessageBox(NULL,_T("OpenFail"),_T("OpenRecordset"),MB_OK);
    12. }
    13. VARIANTvPwd;
    14. VariantInit(&vPwd);
    15. CStringstrParam=_T("privilege");
    16. vPwd=wicDB.GetCollect(strParam);
    17. MessageBox(NULL,vPwd.bstrVal,_T("OpenRecordset"),MB_OK);
    18. wicDB.CloseDB();
    19. returnTRUE;
    1. CStringtest1=_T("TestUPC1"),test2=_T("1234567");
    2. wicDB.SetItemPrice(test1,test2);
    3. 测试SetItemPrice函数
    1. LastTransaction*ltExample;
    2. if(wicDB.GetLastTransData(ltExample))
    3. {
    4. ;
    5. }
    1. LastTransactionltExample={"004","4","40","123","08102","11111","08102011111"};
    2. //在初始化的时候注意字符初始化的时候大小问题
    3. if(wicDB.SetLastTransData(ltExample))
    4. {
    5. ;
    6. }

你可能感兴趣的:(execute)