R
Ruslan Shlain
A little problem I am having and its driving me nuts.
I have a datatable and I am adding a column to it on the fly. Then based on
some other fields i add or not add a value to that column for each row.
When I do update statement on DataAdapter I get "Specified cast is not
valid". The DB column is varchar 50. Here is my code.
dsDS.Tables[0].Columns.Add("dt_date");
int i;
for(i = 0;i < objTIC.Count; i++)
{
string k = objTIC;
string[] s = k.Split(',');
foreach (DataRow dr in dsDS.Tables[0].Rows)
{
if (dr["number"].ToString() == DBNull.Value)
{
dr["dtcontract_date"] = "1";
}
}
}
I have a datatable and I am adding a column to it on the fly. Then based on
some other fields i add or not add a value to that column for each row.
When I do update statement on DataAdapter I get "Specified cast is not
valid". The DB column is varchar 50. Here is my code.
dsDS.Tables[0].Columns.Add("dt_date");
int i;
for(i = 0;i < objTIC.Count; i++)
{
string k = objTIC;
string[] s = k.Split(',');
foreach (DataRow dr in dsDS.Tables[0].Rows)
{
if (dr["number"].ToString() == DBNull.Value)
{
dr["dtcontract_date"] = "1";
}
}
}