简体   繁体   English

Schema.ini文本宽度限制太短

[英]Schema.ini Text Width Limit too Short

I created an ODBC connection to a text file which is full of log entries in VS 2012 thanks to some insight from this thread Microsoft Access Text ODBC Driver on Windows 7 . 由于从Windows 7上的Microsoft Access Text ODBC Driver这个线程中获得了一些见识,因此我创建了一个到VS 2012中充满日志条目的文本文件的ODBC连接。 Currently I'm only running queries on the file from within the Query Designer in VS. 目前,我只在VS的查询设计器中对文件运行查询。
My schema.ini file looks like this: 我的schema.ini文件如下所示:

[logFile.txt]
ColNameHeader=True
Format=FixedLength
MaxScanRows=0
Col1=Thread Integer Width 6
Col2=Date Integer Width 6
Col3=Time Integer Width 11
Col4=File Char Width 5
Col5=Data Char

and a sample line from the log is: 日志中的示例行是:

1124 0905 144022706 FILE SomeFile::SomeFunction(), Some Log Message // Stuff001.CPP 1124 0905 144022706文件SomeFile :: SomeFunction(),某些日志消息// Stuff001.CPP

The query runs successfully but I have some log lines where the Data portion is thousands of characters long but the Char type supports a maximum of 256 characters. 查询运行成功,但是我有一些日志行,其中“数据”部分的长度为数千个字符,但“ Char类型最多支持256个字符。
I've found alternatives such as Memo and LongChar ( http://msdn.microsoft.com/en-us/library/ms709353%28VS.85%29.aspx ) but whenever I substitute either of the two I get an error: 我找到了Memo和LongChar( http://msdn.microsoft.com/en-us/library/ms709353%28VS.85%29.aspx )之类的替代方法,但是每当我替换二者之一时,都会出现错误:

ERROR [HY000] [Microsoft][ODBC Text Driver] In the text file specification 'logFile.txt', the Data option is invalid. 错误[HY000] [Microsoft] [ODBC文本驱动程序]在文本文件规范'logFile.txt'中,“数据”选项无效。

Great! 大! Am I stuck with clipped log lines or is there an alternative? 我会被剪切的日志线卡住还是有其他选择? I'm on Win7 64-bit btw. 我在Win7 64位btw上。

Found the solution. 找到了解决方案。 While Char can be used without specifying a width the same cannot be said about LongChar. 尽管可以使用Char而无需指定宽度,但关于LongChar却不能说相同。
My new schema looks like this: 我的新架构如下所示:

[logFile.txt]
ColNameHeader=True
Format=FixedLength
MaxScanRows=0
Col1=lThread Integer Width 6
Col2=lDate Integer Width 6
Col3=lTime Integer Width 11
Col4=lFile Char Width 5
Col5=lData LongChar Width 24032

There was a performance hit with the lData width being set to 24k, but no noticeable difference when it was set to as much as 4,000. 将lData宽度设置为24k会对性能造成影响,但是将其设置为4,000则没有明显的区别。 There is more information about ODBC text files at http://msdn.microsoft.com/en-us/library/ms715429(v=vs.85).aspx . http://msdn.microsoft.com/zh-cn/library/ms715429(v=vs.85).aspx上有有关ODBC文本文件的更多信息。

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

相关问题 使用“ Microsoft文本驱动程序”是否需要使用schema.ini文件? - Does using the “Microsoft Text Driver” require the use of a schema.ini file? 单个 schema.ini 定义可以覆盖多个文件吗 - Can a single schema.ini definition cover multiple files 如何使用特殊字符从schema.ini构建DataTable模式 - How can I build a DataTable schema from schema.ini with special characters 使用schema.ini的C#import CSV文件创建表但不加载数据 - C# import CSV file with schema.ini creates table but doesn't load data 我怎样才能创建schema.ini文件?我需要将.csv文件导出到datagridview - How can I create schema.ini file? I need to export my .csv file to datagridview 将文本限制为TextBox的宽度 - Limit text to width of TextBox 自由文本框宽度限制/包装 - Free Text Box width limit/wrapping 如何限制列的宽度并使其文本换行 - How to limit the width of a column and make its text wrap 如果字符串太短,子字符串将不起作用 - Substring will not work if the string is too short 为什么当RadioButton文本值短时,自动调整GroupBox及其RadioButton子级的大小不会减小GroupBox的宽度? - Why does Autosizing a GroupBox and its RadioButton Children not reduce the GroupBox's width when the RadioButton text values are short?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM