2012-04-04 22 views
5

Zdefiniowałem plik schema.ini dla pliku CSV, ale mam wiele plików CSV, które chciałbym użyć tej samej definicji, ponieważ są sekwencjami.Czy pojedyncza definicja schematu.ini może obejmować wiele plików?

Ie

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

Mój schemat byłoby coś jak:

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

To pojawi się powyższy * pomysł nie działa, czy ktoś ma lepszą sugestię? –

Odpowiedz

5

miarę mogę powiedzieć, to nie jest możliwe

- * ** * **** W rzeczywistości jest posibl e, możesz to zrobić w ten sposób.

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

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

Pozdrawiam!

0

Możesz zdefiniować i zapisać schemat w swoim module/podprogramie zgodnie z formatem pliku, który chcesz przesłać. Ten moduł/podprogram należy uruchomić/zadzwonić do tworzenia schematu przed uruchomieniem przesyłania .. (moja próbka jest za pomocą VB6)

Uwaga: - Filenametxt jest nazwa pliku, który chce być przesłany

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 
Powiązane problemy