Home News DOC Class DL Others Rice
Class  >  dbreader  >  Ordinal(string)
dbreader class : Ordinal(string) method

Description

Returns the column number.

Syntax

instance.Ordinal(string columnName)

Arguments

ClassNameDescription
stringcolumnNameColumn name.

Return value

ClassDescription
intColumn number.

Sample code

1:

connection cnn = new connection("Data Source=c:\somedirectory\somedatabase.sqlite3;Version=3;");

2:

cnn.Open();

3:

command cmm = new command("select * from sometable where id < 100;", cnn);

4:

dbreader dbr = cmm.Reader(); // Command execution. Returns multi-line results.

5:

int columnNumber = dbr.Ordinal("Appropriate column name");

6:

dbr.Release();

7:

cmm.Release();

8:

cnn.Close();

9:

cnn.Release();

Notes

The column number is returned if the column corresponding to the argument exists. Otherwise, returns -1.

The column number is a 0-based index.

Links for reference

None.

Copyright © Rice All rights reserved.