Форум: "Основная";
Текущий архив: 2002.03.04;
Скачать: [xml.tar.bz2];
ВнизГде в DBGrid поставить разделитель между столбцами ! Найти похожие ветки
← →
IronHawk (2002-02-11 18:57) [0]У меня в файле текстовом разделитель ";" где его прописать что б он принимался в DBGrid ???
← →
Анонимщик (2002-02-11 20:21) [1]Ты через что доступаешься - через ADO или BDE?
Вообще говоря, нужен будет файл с расширением sch (или schema.ini), в котором нужно прописать некоторые настройки - количество полей, их тип, разделители, и т. д. Где-то в хелпе есть что-то такое, но очень запрятанное. Вот пример, если чего не поймешь, ответь, чем пользуешься и вопросик уточни. И, кстати, DBGrid тут не при чем, а при чем - TTable (TADOTable).
Пример файла schema.ini
[1.txt]
ColNameHeader=True
Format=Delimited(;)
MaxScanRows=25
CharacterSet=OEM
Col1=A Char Width 255
Col2=K Integer
Col3=J Char Width 255
← →
IronHawk (2002-02-12 10:23) [2]>>> Анонимщик
Доступаюсь через BDE !
А если мне дез *.ini надо
яж могу эти параметры и в событие запихнуть
так лучше, а то пользоватили ручками полезть могут
в *.ini и я потом всё заново настраивать буду !!!
A разделитель я новый выбрал менее конфликтный - "|".
← →
Анонимщик (2002-02-12 11:18) [3]Тогда найди в хелпе, какой файл с описанием формата нужно создать для доступа к текстовому файлу. Хранить его нужно в том же каталоге, что и сам текстовый файл. Если не ошибаюсь, то его можно и не создавать, а действительно описание каким-то образом держать в памяти. Ну не помню расширения, кажется, sch (схема т.е.). А какой разделитель - это все равно. Если тебе так уж нужно, то посмотрю этот файл, дома он где-то есть такой.
← →
IronHawk (2002-02-12 12:16) [4]>>> Анонимщик
ОК !
Посмотри пожалуйста ...
а ежели ещё и пример найдёшь на исспользованои "оного"
ваще прекрасно буит ...
... заранее длагодарен !
← →
Анонимщик (2002-02-12 14:01) [5]Хорошо, есть и пример, но только завтра.
← →
IronHawk (2002-02-13 10:34) [6]OK !
ЖДУ !
← →
Анонимщик (2002-02-13 11:07) [7]Borland Database Engine Online Reference -
этот хелп есть в стандартной поставке. Цитата из него далее. Пиши, вышло или нет. И еще одно, чтобы по-человечески сколь-нибудь разобраться с доступом к базам данных с помощью борландовских средств, начни с примера -
C:\Program Files\Borland\Delphi5\Demos\DB\Textdata. Он, конечно, упрощенный, но когда-нибудь может сильно помочь.
Schema File
All information in the schema file is case-insensitive.
Here is a sample schema file:
[CUSTOMER] // File name with no extension.
FILETYPE = VARYING // Format: VARYING or FIXED
CHARSET = ascii // Language driver name.
DELIMITER = " // Delimiter for char fields.
SEPARATOR = , // Separator character
Field1 = Name,CHAR,12,0,0 // Field information
Field2 = Salary,FLOAT,8,2,12
The schema file has a format similar to Windows INI files. The file begins with the name of the table in brackets. The second line specifies the file format following the keyword FILETYPE: FIXED or VARYING.
FIXED format file
Each field always takes up a fixed number of characters in the file, and the data is padded with blanks as needed.
VARYING format file
Each field takes a variable number of characters, each character field is enclosed by DELIMITER characters, and the fields are separated by a SEPARATOR character. The DELIMITER and SEPARATOR must be specified for a VARYING format file, but not for a FIXED format file.
The CHARSET attribute specifies the name of the language driver to use. This is the base filename of the .LD file used for localization purposes.
The DELIMITED character surrounds the text field types (alphanumeric or character) in the text file. Delimited fields must be of character type.
The field SEPARATOR character separates the text file field values.
The remaining lines specify the attributes of the table"s fields (columns). Each line must begin with "Fieldx = ", where x is the field number (that is. Field1, Field2, and so on).
Next appears a comma-delimited list specifying:
Field name. Same restrictions as Paradox field names.
Data type. The field data type. See below.
Number of characters or units. Must be <= 20 for numeric data types. Total maximum number of characters for date/time data types (including / and : separators).
Number of digits after the decimal (FLOAT only).
Offset. Number of characters from the beginning of the line that the field begins. Used for FIXED and DELIMITED formats.
The following data types are supported:
CHAR - Character
FLOAT - 64-bit floating point
NUMBER - 16-bit integer
BOOL - Boolean (T or F)
LONGINT - 32-bit long integer
DBIDATE - Date field. Format specified in Registry
TIME - Time field. Format specified in Registry
TIMESTAMP - Date/Time field. Format specified in Registry
Note: You specify date and time formats by using the BDE Administrator.
Example 1: VARYING format file
CUSTOMER.SCH:
[CUSTOMER]
Filetype=VARYING
Delimiter="
Separator=,
CharSet=ascii
Field1=Customer No,Float,20,04,00
Field2=Name,Char,30,00,20
Field3=Phone,Char,15,00,145
Field4=First Contact,Date,11,00,160
CUSTOMER.TXT:
1221.0000,"Kauai Dive Shoppe","808-555-0269",04/03/1994
1231.0000,"Unisco","809-555-3915",02/28/1994
1351.0000,"Sight Diver","357-6-876708",04/12/1994
1354.0000,"Cayman Divers World Unlimited","809-555-8576",04/17/1994
1356.0000,"Tom Sawyer Diving Centre","809-555-7281",04/20/1994
All the BDE API functions work with the text driver. To support external schema binding, the text driver includes the database property dbUSESCHEMAFILE applicable only to the text driver.
If the dbUSESCHEMAFILE property is set to true at the time of an export to a text table, the schema information of that text table is stored in a schema file. The DbiBatchMove function is used in exporting data to a text file. DbiBatchMove automatically stores the schema information while copying the data to a text table.
If the dbUSESCHEMAFILE flag is set to TRUE at the time of an import and a schema file exists for the text table, the text driver gets the field descriptors from the schema text file and sets them as the default fields for that text table. If the dbUSESCHEMAFILE flag is not set, you should define the field descriptions of the text table by using the function DbiSetFieldMap.
← →
IronHawk (2002-02-13 14:05) [8]АААААААААААААААА!
>>> Анонимщик ©
СПАСИБО !!!!
Страницы: 1 вся ветка
Форум: "Основная";
Текущий архив: 2002.03.04;
Скачать: [xml.tar.bz2];
Память: 0.47 MB
Время: 0.004 c