0

How to insert query in the DBAdapter? This is my sql insert query. Its create fields & values at runtime. Then need to execute.

This is my code:

  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);
}

Please tell me how to do this part.

Please help me..

Thanks in advance..

1 Answer 1

1

try initialValues.put(strToFields,strValue);

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.