vb@rchiv
VB Classic
VB.NET
ADO.NET
VBA
C#
Brandneu! sevEingabe v3.0 - Das Eingabecontrol der Superlative!  
 vb@rchiv Quick-Search: Suche startenErweiterte Suche starten   Impressum  | Datenschutz  | vb@rchiv CD Vol.6  | Shop Copyright ©2000-2025
 
zurück

 Sie sind aktuell nicht angemeldet.Funktionen: Einloggen  |  Neu registrieren  |  Suchen

VB & Datenbanken
Re: csv in Recordset einlesen 
Autor: SL
Datum: 23.09.03 12:57

Du mußt eine Schema.INI - Datei im gleichen Verzeichnis wie die *.csv-Datei anlegen, die die Feldbeschreibungen enthält.

Auszug aus der MSDN:
Creating a Schema Information File
Microsoft Access determines the format of a text file either by reading the file directly or by using a schema information file that overrides the default settings in the Windows Registry. The schema information file is always named Schema.ini. In order for Microsoft Access to use the information in the Schema.ini file, you must store it in the same folder as the text data source. A Schema.ini file is always required for accessing fixed-width data, and is recommended when your text file contains Date/Time, Currency, or numeric floating-point data, or any time you want more control over handling the data in the text file. You do not need a separate Schema.ini file for each text file you want to link.
You can use any text editor to create a Schema.ini file. In your Schema.ini file, you add entries, each of which specifies one of five characteristics of the text file:
The text file name
The file format
The field names, widths, and data types
The character set
Special data type formats and conversions

Specifying the File Name
The first entry in a Schema.ini file is always the name of the text source file enclosed in brackets. For example, to specify the file Sample.txt as your text data source, you would add the following text as the first entry in your Schema.ini file:
[Sample.txt]

Specifying the File Format
The Format entry in a Schema.ini file specifies the format of the text file, such as whether it is delimited or fixed-width. You can set the Format entry to any of the values listed in the following table.
Format value File format

TabDelimited Fields in the text file are delimited by tabs.
CSVDelimited Fields in the text file are delimited by commas.
Delimited(*) Fields in the text file are delimited by asterisks. You can substitute any character
for the asterisk except the double (") quotation mark.
FixedLength Fields in the text file are of a fixed width.
For example, to specify a comma-delimited format, you would add the following entry to the Schema.ini file:
Format=CSVDelimited

Specifying the Field Names, Widths, and Data Types
For delimited text files, you can specify field names in one of two ways:
Include the field names in the first record of the text file and set the ColNameHeader entry to True to indicate that the first record of data specifies field names.
Specify each field by number and designate the field name and data type.
You can have Microsoft Access determine the data types of the fields for you. Set the MaxScanRows entry to the number of records Microsoft Access should scan when it determines the field data types. If you set the MaxScanRows entry to 0, Microsoft Access scans the entire file. For example, to specify that Microsoft Access should use the data in the first record in the text file as field names and should examine the entire file to determine the data type of each field, add the following entries to your Schema.ini file:
ColNameHeader=True
MaxScanRows=0
For fixed-width files, you must specify each field by number and designate the field name, data type, and width. To do so, set the Coln entry; the syntax of the Coln entry is:
Coln=ColumnName type [Width #]
The following table describes each part of the Coln entry.
Part Description

ColumnName The name of the field. If the field name contains embedded spaces, you must
enclose it in double quotation marks.
type Specifies the data type for the field. It can be any of the following data types.
Width The literal string value Width. Indicates that the number that follows specifies the
width of the field (required for fixed-width files).
# The integer value that specifies the number of characters in the field (required if
Width is specified).
For example, to specify two fields, a 10-character CustomerID text field and a 30-character CustomerName text field, add the following entries to your Schema.ini file:
Col1=CustomerID Text Width 10
Col2=CustomerName Text Width 30

Specifying a Character Set
The CharacterSet entry specifies which character set your computer uses. You can specify one of two character sets: ANSI or OEM. For example, to specify the ANSI character set, add the following entry to your Schema.ini file:
CharacterSet=ANSI
alle Nachrichten anzeigenGesamtübersicht  |  Zum Thema  |  Suchen

 ThemaViews  AutorDatum
csv in Recordset einlesen8.982jenst23.09.03 11:06
Re: csv in Recordset einlesen5.993SL23.09.03 12:57
Fortsetzung5.368SL23.09.03 12:58
Gegenfrage5.025SL23.09.03 13:01
Re: csv in Recordset einlesen7.832jenst23.09.03 13:57
Re: csv in Recordset einlesen5.001Sacha Kreher23.01.06 13:37

Sie sind nicht angemeldet!
Um auf diesen Beitrag zu antworten oder neue Beiträge schreiben zu können, müssen Sie sich zunächst anmelden.

Einloggen  |  Neu registrieren

Funktionen:  Zum Thema  |  GesamtübersichtSuchen 

nach obenzurück
 
   

Copyright ©2000-2025 vb@rchiv Dieter Otter
Alle Rechte vorbehalten.
Microsoft, Windows und Visual Basic sind entweder eingetragene Marken oder Marken der Microsoft Corporation in den USA und/oder anderen Ländern. Weitere auf dieser Homepage aufgeführten Produkt- und Firmennamen können geschützte Marken ihrer jeweiligen Inhaber sein.

Diese Seiten wurden optimiert für eine Bildschirmauflösung von mind. 1280x1024 Pixel