Home Notices Documents Classes Download Others Rice
Classes  >  dbreader  >  FieldType(string)
dbreader class : FieldType(string) method

Description

Returns the type of a given column.

Syntax

dbreaderInstance.FieldType(string columnName)

Arguments

ClassNameDescription
stringcolumnNameThe column name.

Return value

ClassDescription
stringThe type name.

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. A multi-line result is returned.

5:

while(dbr.Read())

6:

string typename = dbr.FieldType("shop"); // The type name for the "shop" column.

7:

endwhile

8:

dbr.Release();

9:

cmm.Release();

10:

cnn.Close();

11:

cnn.Release();

Notes

Please note that the type name obtained by this method may differ from the type used to retrieve the actual value.

For example, if you specify an integer column for this method, the "int" is returned as the type name in most cases, but when you retrieve the actual value from the integer column, the value is returned as an instance of the long class.

Links for reference

None.

Copyright © Rice All rights reserved.