views:

211

answers:

1

Using C#, I'm trying to create a form with a dataGridView that shows the contents of a fixed width, flat file database. Does using the "Microsoft Text Driver" require the use of a schema.ini file? Below is the connection string I'm using. I cant seem to get the grid to fill regardless of whether I use one or not but I'm not sure if I even need it to begin with. I'm not finding a whole lot of info on the subject. I'm also not sure if this is even the best method for working with such files. Any guidance would be appreciated.

string ConnectionString = @"Driver={Microsoft Text Driver (*.txt; *.csv)};DBQ=c:\files";

Thanks

+1  A: 

It has been a while, but I believe you must have the schema.ini.

I used this driver often years ago. (Monthly reporting for four years.) Not too much need for it today. I never had a problem using it. Any problems were usually due to issues with the text file.

Schema.ini File (Text File Driver) at http://msdn.microsoft.com/en-us/library/ms709353(VS.85).aspx

Bing Search at http://www.bing.com/search?q=%22Schema.ini+File+%28Text+File+Driver%29%22

Information regarding this driver is under ODBC at MSDN Library.

Working schema.ini example for two text files:

[networth.txt]
ColNameHeader=False
Format=TabDelimited
MaxScanRows=25
CharacterSet=OEM

[trans.txt]
ColNameHeader=False
Format=TabDelimited
MaxScanRows=25
CharacterSet=OEM
Col1=F1 Char Width 255
Col2=F2 Char Width 255
Col3=F3 Char Width 255
Col4=F4 Char Width 255
Col5=F5 Char Width 255
Col6=F6 Char Width 255
Col7=F7 Float
AMissico
Thanks for the info AMissico.
JimDel