Here is code that I have used over and over in other programs to create a comma delimited file. I add it to a record for a number value column. The code in yellow does not work in VS2012. So I converted it back to VS2010 and it works. It was in VS2010 and I converted it to VS2012. I did not realize right away that the numbered columns did not have a value anymore. I tried lots of things to get this to work.
Thank you for anyone that can help on this. I am supposed to do my development in VS2012.
arep
for (int fcnt = 0; fcnt < dr.FieldCount; fcnt++)
{
if (fcnt == 21 && name == "Medical")
paidamt = paidamt + (decimal)dr.GetValue(fcnt);
}
//Handle strings
if (dr.GetValue(fcnt).GetType() == typeof(string))
sb.Append("\"");
sb.Append(dr.GetValue(fcnt));
//Handle numbers
else if (dr.GetValue(fcnt).GetType() == typeof(decimal))
sb.Append((double)(dr.GetDecimal(fcnt)));
//Handle dates
else if (dr.GetValue(fcnt).GetType() == typeof(int))
sb.Append(dr.GetInt32(fcnt).ToDate());
if (fcnt != dr.FieldCount - 1) sb.Append(",");
sw.WriteLine(sb.ToString()); // Print data rows
sb.Clear();
reccnt++;