GetDatabaseSourceFields

From VLECK
Jump to: navigation, search

Reads metainformation about a dataset in a database.

Syntax

result = GetDatabaseSourceFields(handle);

Return Value

GetDatabaseSourceFields returns the selected field information as a structure. The following is returned:

1 Name Name of the field
2 Type the data type of the field. (See table below)
3 Size the maximum size, in bytes, of a field that contains text or the fixed size of a field that contains text or numeric values.
4 Attributes Attributes of the field, such as Fixed/Variable size, AutoIncrement, Updatable and sort order. The attributes are logically OR-ed. For details, see the topic "Attributes Property" in DAO Help.
5 OrdinalPosition OrdinalPosition of the field
6 Required whether a DAO field object requires a non-Null value
7 AllowZeroLength whether an empty string ("") is a valid value
8 CollatingOrder the sequence of the sort order in text for string comparison or sorting
9 ForeignName A value that, in a relation, specifies the name of the DAO field object in a foreign table that corresponds to a field in a primary table
10 SourceField the name of the field that is the original source of the data. This property indicates the original field name associated with a field object. For example, you could use this property to determine the original source of the data in a query field whose name is unrelated to the name of the field in the underlying table.
11 SourceTable the name of the table that is the original source of the data. This property indicates the original table name associated with a field object. For example, you could use this property to determine the original source of the data in a query field whose name is unrelated to the name of the field in the underlying table
12 ValidationRule A value that validates the data in a field as it is changed or added to a table
13 ValidationText specifies the text of the message that your application displays if the value of the field does not satisfy the validation rule specified by the ValidationRule property setting
14 DefaultValue DefaultValue of the field


The value of the type can be one of the following:

Type Size (Bytes) Description
1 1 byte Yes/No (same as True/False)
2 1 Byte
3 2 Integer
4 4 Long
5 8 Currency (COleCurrency)
6 4 Single
7 8 Double
8 8 Date/Time (COleDateTime)
10 1 - 255 Text (CString)
11 0 Long Binary (OLE Object; CByteArray; use instead of CLongBinary)
12 0 Memo (CString)
15 16 A Globally Unique Identifier/Universally Unique Identifier used with remote procedure calls.

WARNING: if the handle is not valid, e.g. the database is not open, NSM will crash unrecoverably.

Parameters

handle handle obtained with OpenDatabaseSource.


Example

dbhandle = OpenDatabase("D:\Projects\ForGem\Meteo\MeteoData.mdb");

handle   = OpenDatabaseSource(  "SummerRain"; dbhandle);

fields   = GetDatabaseSourceFields( handle);

CloseDatabase(dbhandle);

1

fields
[1] : Name	[2] : Type	[3] : Size	[4] : Attributes	
[5] : OrdinalPosition	[6] : Required	[7] : AllowZeroLength	[8] : CollatingOrder	
[9] : ForeignName	[10] : SourceField	[11] : SourceTable	[12] : ValidationRule	
[13] : ValidationText	[14] : DefaultValue

See Also