Problem with AdomdCommand with passing DataTable with DBNull in some cells

  • Thread starter Thread starter Nestor
  • Start date Start date
N

Nestor

The following code would fail, with the error:

"The '' string cannot be converted to the double type."

when trainTable contains rows with DBNull in some of the columns.
How can I pass NULL to MSAS?

using (AdomdCommand comm = connAS.CreateCommand())
{
comm.CommandText = "INSERT INTO MINING MODEL [MyModel]
([statbbrev],[lpop],[ldem],[lemp]) @TrainTable";
comm.Parameters.Add("TrainTable", trainTable);
comm.ExecuteNonQuery();
}
 
Back
Top