Monthly Archives: June 2009

Convert Hex to Readable String and Readable Text to Hex

If you ever need to convert Hex data to readable strings or the reverse, try the following methods:   private static readonly  char[] HexChars = "0123456789ABCDEF".ToCharArray();   private static string ConvertToHex(string ascii) { if (ascii == null) return null; if … Continue reading

Posted in C# | Leave a comment

Read a CSV file with Regular Expressions in .Net

Here’s how you can read a CSV file using Regular Expressions in .Net: </p> public static DataTable GetDataTableFromCsvFile(string file) { // Where the CSV data goes DataTable dt = new DataTable("CsvData");   // The pattern used to parse the CSV … Continue reading

Posted in C#, Regular Expressions | Leave a comment

Reading a CSV File with an OleDbDataAdapter and Jet

Reading a comma delimited is quite simple with an OleDbDataAdapter and Jet 4.0:   private static DataTable ReadCsvFileViaJetOleDb(string file) { string connection = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=\"" + Path.GetDirectoryName(file) + "\\\";Extended Properties=\"text;HDR=Yes;FMT=Delimited\"";   string query = "SELECT * FROM " + file; … Continue reading

Posted in C# | Leave a comment

July 2009 IT Toolbox Column for TechNet Magazine

The July 2009 issue of TechNet Magazine is out on the website. Check out my IT Toolbox column here: July 2009 TechNet Magazine IT Toolbox In this issue I cover: ObserveIT Express: Audit your Users’ Sessions Mouse Tracks 2009 Enterprise … Continue reading

Posted in Microsoft TechNet | Leave a comment