dbreader class : Get(int) method

Description

Returns the value of the specified column.

Syntax

instance.Get(int columnIndex)

Arguments

ClassNameDescription
intcolumnIndexColumn index.

Return value

ClassDescription
stringA value of the column.

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:

while(dbr.Read())

6:

string value = dbr.Get(0); // The value of the first column.

7:

endwhile

8:

dbr.Release();

9:

cmm.Release();

10:

cnn.Close();

11:

cnn.Release();

Notes

Please note that the return value is string.

If the result is a number, the number will be returned as a string. Example: 1-> '1' , 1.05-> '1.05'.

If the result is a string, the string will be enclosed in double quotes and returned. Example: 'Returned string' -> '"Returned string"'.

If the result is null or cannot be evaluated, the string, 'null', is returned.

The argument should specify in a 0-based index.

If the column corresponding to the argument does not exist, an exception, UnknownException, will be thrown.

Links for reference

None.

Copyright © Cooker All rights reserved.