try to store log data in rows, not in columns
string[] fileContents = null;
List<string> words = new List<string>();
List<string> words1 = new List<string>();
DataTable workTable = new DataTable();
try
{
fileContents = File.ReadAllLines(file);
}
catch (Exception ex)
{
throw new Exception("The Input log file was not found or is not in correct format\nDetails: " + ex.Message);
}
if (fileContents == null)
throw new Exception("The Input log file was not found or is not in correct format");
workTable.Columns.Add("login");
workTable.Columns.Add("code");
for (int Index = 0; Index < fileContents.Length; Index++)
{
string CANMsgId = string.Empty;
string[] spaceSeperator = new string[] { " " };
string[] lineWords = (fileContents[Index].Trim()).Split(spaceSeperator, StringSplitOptions.RemoveEmptyEntries);
if (lineWords.Length < (2 + 1))
continue;
if (lineWords[2].EndsWith("x"))
{
int i = 1;
workTable.Rows.Add(lineWords[2].TrimEnd('x'),lineWords[0]);
workTable.Columns.Add(lineWords[2].TrimEnd('x'));
workTable.Columns.Add(lineWords[0]);
i++;
}
}