有多个参数原料查询多个、原料、参数

由网友(小布丁陪着我)分享简介:preF_NAME,preF_STATUS - 文本它给了我这个错误: 07-02 14:08:07.457:E / AndroidRuntime(17295):android.database.sqlite.SQLiteException:?附近:语法错误:,在编译:SELECT?来自哪里?在哪里办理? =?...

preF_NAME,preF_STATUS - 文本

它给了我这个错误:

  07-02 14:08:07.457:E / AndroidRuntime(17295):android.database.sqlite.SQLiteException:?附近:语法错误:,在编译:SELECT?来自哪里?在哪里办理? =? 

在code,我使用的是:

 光标C = db.rawQuery(选择?从何处?=?,新的String [] {preF_STATUS,   preF_TABLE,preF_NAME,assigned_ pref_name}); 

解决方案 电 磁 热弹性多相复合材料的多场有效性能参数预测

有根据文档,你只能把?在where子句:

 公共光标rawQuery(SQL字符串,字符串[] selectionArgs两个)参数SQL中的SQL查询。 SQL字符串切不可;终止selectionArgs两个你可以包含?s在查询中,将由来自selectionArgs两个值来代替条款。该值将被绑定为字符串。 

PREF_NAME, PREF_STATUS - text

It gives me this error:

07-02 14:08:07.457: E/AndroidRuntime(17295): android.database.sqlite.SQLiteException: near "?": syntax error: , while compiling: SELECT ? FROM ? WHERE ? = ?

The code I'm using is:

Cursor c = db.rawQuery("SELECT ? FROM ? WHERE ? = ?", new String[]{ PREF_STATUS,
   PREF_TABLE, PREF_NAME, assigned_pref_name });

解决方案

According with the documentation, you only can put "?" on where clause:

public Cursor rawQuery (String sql, String[] selectionArgs)

Parameters
sql the SQL query. The SQL string must not be ; terminated
selectionArgs   You may include ?s in where clause in the query, which will be replaced by the values from selectionArgs. The values will be bound as Strings.

阅读全文

相关推荐

最新文章