M
MFRASER
I have to import a CSV file into my system and I am currently spliting the
rows and then the columns and inserting that data into my objects. This is
very slow, does anyone have another way of doing this?
Here is my psuedo code
//Reload DetailIDs
char[] Newline = System.Environment.NewLine.ToCharArray();
string[] Rows = strData.Split(Newline);
int MaxRows = Rows.GetUpperBound(0);
//Loop through each row and parse out first column
for (i = 0; i <= MaxRows ; i++)
{
string ColumnData = Rows.Trim();
if (ColumnData.Length > 0)
{
string[] Cols = ColumnData.Split(',');
//Get each Value
for(int tmpCounter = ColValIndex; tmpCounter <= ColMax; tmpCounter++)
{
//Do something
}
}
}
rows and then the columns and inserting that data into my objects. This is
very slow, does anyone have another way of doing this?
Here is my psuedo code
//Reload DetailIDs
char[] Newline = System.Environment.NewLine.ToCharArray();
string[] Rows = strData.Split(Newline);
int MaxRows = Rows.GetUpperBound(0);
//Loop through each row and parse out first column
for (i = 0; i <= MaxRows ; i++)
{
string ColumnData = Rows.Trim();
if (ColumnData.Length > 0)
{
string[] Cols = ColumnData.Split(',');
//Get each Value
for(int tmpCounter = ColValIndex; tmpCounter <= ColMax; tmpCounter++)
{
//Do something
}
}
}