IIS 5 & IIS 6
LogParse, C#, CSV and Validation
Last post Jun 05, 2006 03:53 PM by tomkmvp
Jun 05, 2006 11:30 AM|Liming|LINK
I'm new at creating a C# application that uses LogParser.
1. How do I import a csv file in my code? I was able to parse IIS log file okay, but my csv file doesn't have any header, so I don't know what columsn to query against? In addition, how do I specify my delimiter? I've searched the command line query goes something
logparser "SELECT Field1 AS Date, Field2 AS Time, Field7 AS User,
Field9 AS Description FROM c:\Temp\Securiy.csv WHERE Field6=560" -i:csv -headerRow:Off
but I haven't found a way to specifiy my own delimiter.
2. I'm trying to import this cvs file and I need to know if certain columns are in certain types. For example, first column is a date type, second column is an integer type. If they are not, I need to get an error message.
Can logparser do that?
Jun 05, 2006 02:33 PM|tomkmvp|LINK
1. Don't you know the source you're querying against? If it has no header, you'll need to know what fields there are. As for a delimeter, isn't it a comma (Comma
Jun 05, 2006 03:20 PM|Liming|LINK
i should've broken up #1 into another question. In addition to import csv file, if I have a text file much like a csv file but with custom delimiter,how do I specify a custom delimiter?
Jun 05, 2006 03:53 PM|tomkmvp|LINK