Filling dataset from text file.

R

Ruslan Shlain

I am getting data from a text file using the folowing code. It uses the
schema.ini file to define a structure of the datatable in the Dataset. The
default file called schema.ini. I have about 10 or 15 tables i have to
populate. Is there a way to specify an ini file i want to use?

Dim Conn As New
System.Data.OleDb.OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data
Source=" & FilePath & ";Extended Properties=""text;HDR=NO;FMT=Delimited""")

Dim Comm As New System.Data.OleDb.OleDbDataAdapter("select * from " &
FileName, Conn)

Dim DS As New DataSet

Try

Comm.AcceptChangesDuringFill = False

Comm.Fill(DS)

End try
 
H

Hussein Abuthuraya[MSFT]

Hi Ruslan,

There is no way to specify a schema.ini file in the connection string. If
it exists in the same folder then the driver will search in it for a
section that matches the text file name. If you have several Text files in
the same directory, then all what you need is one schema.ini file. The
Text ISAM driver knows or expects only one .ini file per folder. The ini
file could contain all the schema definition for all the files. For
example, if your schema.ini has the following:

[myfile1.txt]
.....

[myfile2.txt]
....

Then it contains schema definition for myfile1.txt and myfile2.txt files.

I hope this answers your question.

Thanks,
Hussein Abuthuraya
Microsoft Developer Support

This posting is provided "AS IS" with no warranties, and confers no rights.
You assume all risk for your use. © 2004 Microsoft Corporation. All rights
reserved

Are you secure? For information about the Microsoft Strategic Technology
Protection Program and to order your FREE Security Tool Kit, please visit
http://www.microsoft.com/security.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top