从sqlite数据库中读取数据

时间:2011-03-04 06:29:56

标签: iphone ipad sqlite

我已将我的图像存储在sqlite数据库中..我正在使用以下查询从数据库中读取数据...但“选择”查询无效...如果有人知道,请帮我解决.. < / p>

const char *phssqlStatement="select fld_image ,fld_path from tbl_image where fld_path like ?";
        sqlite3_stmt *phscompiledStatement;

        sqlite3_prepare_v2(database, phssqlStatement, -1, &phscompiledStatement, NULL);
        printf( "could not prepare statemnt: %s\n", sqlite3_errmsg(database));
        //sqlite3_bind_text(compiledStatement,1,[str_imgname1_site UTF8String],250, SQLITE_TRANSIENT);
        //sqlite3_bind_text(phscompiledStatement,1,[zoomedImageURL UTF8String],350,SQLITE_STATIC);
         sqlite3_bind_text(phscompiledStatement, 1, [zoomedImageURL UTF8String],350, SQLITE_TRANSIENT);

2 个答案:

答案 0 :(得分:1)

您忘记将输入var编号为:

const char *phssqlStatement="select fld_image ,fld_path from tbl_image where fld_path like ?1";

答案 1 :(得分:0)

您的SQLite查询应该更像:

const char *phssqlStatement="select fld_image ,fld_path from tbl_image where fld_path like '%?%'";

希望这适合你。