简体   繁体   English

使用“ Microsoft文本驱动程序”是否需要使用schema.ini文件?

[英]Does using the “Microsoft Text Driver” require the use of a schema.ini file?

Using C#, I'm trying to create a form with a dataGridView that shows the contents of a fixed width, flat file database. 我正在尝试使用C#创建一个带有dataGridView的表单,该表单显示固定宽度的平面文件数据库的内容。 Does using the "Microsoft Text Driver" require the use of a schema.ini file? 使用“ Microsoft文本驱动程序”是否需要使用schema.ini文件? 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 谢谢

It has been a while, but I believe you must have the schema.ini. 已经有一段时间了,但是我相信您必须拥有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 http://msdn.microsoft.com/zh-cn/library/ms709353(VS.85).aspx上的 Schema.ini文件(文本文件驱动程序)

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

Information regarding this driver is under ODBC at MSDN Library. 有关此驱动程序的信息位于MSDN Library的ODBC下。

Working schema.ini example for two text files: 两个文本文件的工作schema.ini示例:

[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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM