大家好,我正在尝试使用android中的自定义sqlite查询。
我遇到了以下问题:
1-我的主键由多个列组成。如何在android的Db sqlite中放置数据?有吗?
ContentValues initialValues = new ContentValues();
这个过程会起作用吗?
2-自定义查询
String queryString = "SELECT MAX(accountId) FROM MAAccounts WHERE userId = ? AND accountType = ?";
我想传递两个参数
String userId, AccountType accountType
请注意,userId是字符串类型,而accoutType是int或AccountType。
请告诉我这是否可能在sqlite android中传递自定义查询和参数?如果是,那么是如何实现的呢?
3-另外,在Iphone中我们使用FMD Database
库,有没有像Iphone one一样可以在android中使用的库?
发布于 2012-02-06 04:48:02
对于自定义查询使用方法:
db.rawQuery("MAX(accountId) FROM MAAccounts WHERE userId = ? AND accountType = ?", new String[]{value1,value2});
这里的value1和value2是要传递的值。
https://stackoverflow.com/questions/9155398
复制