[英]Android sqlite dynamic insert query
如何在DBAdapter中插入查询? 这是我的SQL插入查询。 它在运行时创建字段和值。 然后需要执行。
这是我的代码:
public void insertTableRecord(String strTableName, String strToFields, String strValues){
String Sql = "Insert into " + strTableName + "(" + strToFields + ") Values (" + strValues + " )";
DBAdapter dbAdapter = DBAdapter.getDBAdapterInstance(DownlaodTableActivity.this);
dbAdapter.openDataBase();
ContentValues initialValues = new ContentValues();
//initialValues.put("how to give", ??how to give);
long n = dbAdapter.insertRecordsInDB(strTableName, null, initialValues);
}
请告诉我该怎么做。
请帮我..
提前致谢..
尝试initialValues.put(strToFields,strValue);
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.