Try this:
using (CsvReader reader = new CsvReader(strFolderPath + @"\" + strFileName))
{
int intCounter = 0;
foreach (string[] values in reader.RowEnumerator)
{
string[] newVal = new string[values.Length];
int count = 0;
foreach (string val in values)
{
newVal[count] = val.Replace("*", "");
count++;
}
if (reader.RowIndex > 4)
{
if (DAL.InsertPriceList(RegionID, newVal, Session["Username"].ToString()))
{
if (DAL.DBErrorMsg != "")
{
StringBuilder errormessage = new StringBuilder();
errormessage.Append(DAL.DBErrorMsg);
}
}
intCounter++;
}
}
lblUploadSuccess.Text = string.Format("{0} Price List items uploaded to database", intCounter);
lblUploadSuccess.Visible = true;
PopulatePriceListGridView();
}
--Amit