Files
mql5-skills/skills/mql5/references/docs/30-database/1058-database-databasecolumnname.md
T
2026-06-23 21:47:51 +08:00

42 lines
1.3 KiB
Markdown
Raw Blame History

This file contains invisible Unicode characters
This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# DatabaseColumnName
Gets a field name by index.
```
bool  DatabaseColumnName(
   int      request,     // request handle received in DatabasePrepare
   int      column,      // field index in the request
   string&  name         // the reference to the variable for receiving the field name
   );
```
Parameters
request
[in]  Request handle received in [DatabasePrepare()](/en/docs/database/databaseprepare).
column
[in]  Field index in the request. Field numbering starts from zero and cannot exceed [DatabaseColumnsCount()](/en/docs/database/databasecolumnscount) - 1.
name
[out]  Variable for writing the field name.
Return Value
Return true if successful, otherwise false. To get the error code, use GetLastError(), the possible responses are:
- ERR_DATABASE_INVALID_HANDLE (5121) invalid request handle;
- ERR_DATABASE_NO_MORE_DATA (5126)   'column' index exceeds DatabaseColumnsCount() -1.
Note
The value can be obtained only if at least one [DatabaseRead()](/en/docs/database/databaseread) call has been preliminarily made for 'request'.
See also
[DatabasePrepare](/en/docs/database/databaseprepare), [DatabaseColumnsCount](/en/docs/database/databasecolumnscount), [DatabaseColumnType](/en/docs/database/databasecolumntype)