VBBRett
asked on
Column names in C#
Hello, I made an Excel spreadsheet a datatable and I am trying to get information from the columns via using a column name in C#. The problem I am having is my C# error says that the column does not belong in the table. So what kind of format issue am I having?
for (int j = 0; j < dt.Rows.Count; j++)
{
//GroupName1 GroupName2 GroupName3 Snd_Nbr Rcv_Nbr Snd_Size Rcv_Size PartnerTypeName Id_Recipient Id_Regroup SelRecip
string sql = "";
sql =
"insert mpExchangeActivityByUser " +
"select " + MP.Database.Utils.FxQs(dt.Rows[j]["Snd_Nbr"].ToString(), "'") + ", " +
" " + MP.Database.Utils.FxQs(dt.Rows[j]["Snd_Size"].ToString(), "'") + ", " +
" " + MP.Database.Utils.FxQs(dt.Rows[j]["SelRecip"].ToString().Replace("\"", ""), "'") + ", " +
" " + MP.Database.Utils.FxQs(senddate.ToShortDateString(), "'") + " ";
dbu.ExecuteNonQuery(sql);
sql = "";
}
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.