다음을 통해 공유


ICursor.GetColumnIndexOrThrow(String) Method

Definition

Returns the zero-based index for the given column name, or throws IllegalArgumentException if the column doesn't exist.

[Android.Runtime.Register("getColumnIndexOrThrow", "(Ljava/lang/String;)I", "GetGetColumnIndexOrThrow_Ljava_lang_String_Handler:Android.Database.ICursorInvoker, Mono.Android, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null")]
public int GetColumnIndexOrThrow (string? columnName);
[<Android.Runtime.Register("getColumnIndexOrThrow", "(Ljava/lang/String;)I", "GetGetColumnIndexOrThrow_Ljava_lang_String_Handler:Android.Database.ICursorInvoker, Mono.Android, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null")>]
abstract member GetColumnIndexOrThrow : string -> int

Parameters

columnName
String

the name of the target column.

Returns

the zero-based column index for the given column name

Attributes

Exceptions

if the column does not exist

Remarks

Returns the zero-based index for the given column name, or throws IllegalArgumentException if the column doesn't exist. If you're not sure if a column will exist or not use #getColumnIndex(String) and check for -1, which is more efficient than catching the exceptions.

Java documentation for android.database.Cursor.getColumnIndexOrThrow(java.lang.String).

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to

See also