【问题标题】:System.ArgumentException: Column 'sku' does not belong to tableSystem.ArgumentException:列 'sku' 不属于表
【发布时间】:2014-10-27 10:27:35
【问题描述】:

System.ArgumentException:列“sku”不属于表。在 System.Data.DataRow.GetDataColumn(String columnName) 在 System.Data.DataRow.get_Item(String columnName)

正在从 ftp 读取 csv 文件并将其存储在数据表中,该数据表正在更新 db Matched 列...这在本地工作正常... 当我在服务器中部署我的网络服务时,我遇到了上述错误,但无法在我的本地重现。我什至尝试使用无法在本地复制的服务器数据库备份...有什么帮助吗??

【问题讨论】:

  • 如果没有给出任何代码或数据,我认为我们无法为您做任何事情。要得到一个好的答案,你需要一个好的问题。也许你可以编辑它,所以有人可以找到答案。
  • 检查你的表是否不为空,检查 sku 列是否包含在列中等等...

标签: c# sql-server datatable


【解决方案1】:
string datefrom1 = TestContext.DataRow[0].ToString();  
string dateto1 = TestContext.DataRow["Column2"].ToString();
string querydata = TestContext.DataRow["Column3"].ToString();

【讨论】:

  • 使用列索引访问第一列值,然后继续使用字符串列名
猜你喜欢
  • 2021-01-10
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2014-01-24
  • 2017-12-22
  • 2014-07-03
相关资源
最近更新 更多