Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
tecknowledge1164
Starting Member
25 Posts |
Posted - 2008-09-25 : 16:53:43
|
I am writing a program in vb.NET to query a text file and write it out to a SQL database. I do this using a standard Schema.ini file that looks like this:[FileName.txt]Format=Delimited( )TextDelimiter=NoneColNameHeader=TrueI have encountered a situation where I have been asked to process several text files from a folder (over 100 files) and be able to loop through all of the files in one batch. I thought of using a process something like this:Dim d As New IO.DirectoryInfo(sSrcPath) For Each f As IO.FileInfo In d.GetFiles("*.txt", IO.SearchOption.TopDirectoryOnly) sFile = f.Name sSql = "SELECT * FROM " & sFile & " ORDER BY Document_Number" '************ DO SOME STUFF ********************* NextThe problem is that the schema file needs to identify each file by name. Is there a way to modify the schema.ini file each time through the loop so that after the file name is identified it updates the top line of the schema to use that name? any ideas would be appreciated. TIA.Bob Thompson |
|
tecknowledge1164
Starting Member
25 Posts |
Posted - 2008-09-26 : 11:02:19
|
Never mind, I came up with a solution. Basically I just created an IO.StreamWriter to create and append to the schema file each time it identifies a new file name. Fairly simple if you think about it. Thanks anyway. |
|
|
|
|
|