简体   繁体   English

单个 schema.ini 定义可以覆盖多个文件吗

[英]Can a single schema.ini definition cover multiple files

I have defined a schema.ini file for a CSV file, but I have multiple CSVs which I would like to use the same definition for as they are a sequence.我已经为 CSV 文件定义了一个 schema.ini 文件,但我有多个 CSV,我想对它们使用相同的定义,因为它们是一个序列。

Ie IE

File0.csv
File1.csv
File2.csv
File.etc.csv

My schema would be something like:我的模式是这样的:

[File*.csv]
Format=Delimited(,)
ColNameHeader=True
col1="Brand Code" Text
col2=Description Text
col3="Display Sequence" Text

As far as I can tell this isn't possible据我所知这是不可能的

- * ** * **** In fact it's posible, you can do it in this way. - * ** * ****其实是可以的,你可以这样操作。

[file1.csv]
FORMAT = Delimited(#)
ColNameHeader = True
MaxScanRows=10
Col1=...
Col2=...
ColN=...

[File2.csv]
FORMAT = Delimited(#)
ColNameHeader = True
MaxScanRows=10
Col1=...
Col2=...
ColN=...

Regards!问候!

You can define and write the schema in your module/sub routine according to file format that want to be uploaded.您可以根据要上传的文件格式在模块/子例程中定义和编写架构。 This module/sub routine must be run/call to create schema before you run upload.. (my sample is using VB6)在运行上传之前,必须运行/调用此模块/子例程以创建架构。(我的示例使用的是 VB6)

Note: - Filenametxt is File name that want to be uploaded注意:- Filenametxt 是要上传的文件名

IntFileHandleLog = FreeFile
Open App.Path & "schema.ini" For Output As #IntFileHandleLog
Print #IntFileHandleLog, "[" & FileNameTxt & "]"
Print #IntFileHandleLog, "Format=FixedLength"
Print #IntFileHandleLog, "MaxScanRows = 0"
Print #IntFileHandleLog, "CharacterSet = OEM"
Print #IntFileHandleLog, "Col1=" & """" & "Name" & """" & "Text Width 20"
Print #IntFileHandleLog, "Col2=" & """" & "PHONE_NUM" & """" & " Text Width 30"
Print #IntFileHandleLog, "Col3=" & """" & "PHONE_TYPE" & """" & " Text Width 20"
Print #IntFileHandleLog, "col4=" & """" & "UserName" & """" & " Text Width 20"
Print #IntFileHandleLog, "col5=" & """" & "A_STAT" & """" & " Text Width 10"
Print #IntFileHandleLog, "col6=" & """" & "B_STAT" & """" & " Text Width 10"
Print #IntFileHandleLog, "col7=" & """" & "RETRY" & """" & "integer width 2"
Print #IntFileHandleLog, "col8=" & """" & "Birth_Date" & """" & " double width 14"
Print #IntFileHandleLog, "Col9=" & """" & "Joint_Date" & """" & " double width 14"
Close #IntFileHandleLog

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

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