"Column name or number of supplied values does not match table definition." error when calling ExecuteCommand on a DBDataContext object RRS feed

  • Question

  • I thought this would be simple, but I can't understand why I'd get this error? I can use the DBDataContext object to get data from a table, but when I try to update the table:

     _db.ExecuteCommand("UPDATE PODData SET XML = '" + xml + "' WHERE PODID=" + id);

    I get the error stated in the subject. Any thoughts?

    If a response to your question is helpful or answers it please mark it as such!
    Monday, November 8, 2010 5:51 PM


  • OK, it seems the XML field didn't like me passing a string. I got around this by calling a stored procedure that took the string and cast it correctly. Misleading exception message FTL! :(
    Tuesday, November 9, 2010 4:59 PM

All replies