Android.Database.Sqlite.SQLiteDatabase.ExecSQL Method
Execute a single SQL statement that is NOT a SELECT/INSERT/UPDATE/DELETE.

Syntax

[Android.Runtime.Register("execSQL", "(Ljava/lang/String;[Ljava/lang/Object;)V", "GetExecSQL_Ljava_lang_String_arrayLjava_lang_Object_Handler")]
public virtual void ExecSQL (string sql, Java.Lang.Object[] bindArgs)

Parameters

sql
the SQL statement to be executed. Multiple statements separated by semicolons are not supported.
bindArgs
only byte[], String, Long and Double are supported in bindArgs.

Exceptions

TypeReason
Android.Database.SQLExceptionif the SQL string is invalid

Remarks

Execute a single SQL statement that is NOT a SELECT/INSERT/UPDATE/DELETE.

For INSERT statements, use any of the following instead.

For UPDATE statements, use any of the following instead.

For DELETE statements, use any of the following instead.

For example, the following are good candidates for using this method:

  • ALTER TABLE
  • CREATE or DROP table / trigger / view / index / virtual table
  • REINDEX
  • RELEASE
  • SAVEPOINT
  • PRAGMA that returns no data

When using SQLiteDatabase.EnableWriteAheadLogging, journal_mode is automatically managed by this class. So, do not set journal_mode using "PRAGMA journal_mode'" statement if your app is using SQLiteDatabase.EnableWriteAheadLogging

[Android Documentation]

Requirements

Namespace: Android.Database.Sqlite
Assembly: Mono.Android (in Mono.Android.dll)
Assembly Versions: 0.0.0.0
Since: Added in API level 1