sqlite,用sqlite3_prepare处理查询结果,得到记录集

sqlite,用sqlite3_prepare处理查询结果,得到记录集

CString yingEr;

CString erTong;

CString erTongJiaChuang;

//

sqlite3 *db;

sqlite3_stmt * stmt;

sqlite3_open(theApp.getDB_fullPath(), &db);

   char* zErrMsg = 0;

  

sqlite3_prepare(db,

                "select * from tabConfFeiChengRen",

                -1,&stmt,0);

int rc = sqlite3_step(stmt);

while( rc == SQLITE_ROW ){

    CString type = sqlite3_column_text(stmt,0);

    if (type=="yingEr")

    {

      yingEr.Format("%d",sqlite3_column_int(stmt,1));

    }

    else if(type=="erTong")

    {

      erTong.Format("%d",sqlite3_column_int(stmt,1));

    }

    else if(type=="erTongJiaChuang")

    {

      erTongJiaChuang.Format("%d",sqlite3_column_int(stmt,1));

    }

    rc=sqlite3_step(stmt);

}

sqlite3_finalize(stmt);

sqlite3_close(db);

 

 

你可能感兴趣的:(sqlite,用sqlite3_prepare处理查询结果,得到记录集)