【问题标题】:sqlCeDataAdapter.update, Update requires a valid UpdateCommand when passed DataRow collection with modified rowssqlCeDataAdapter.update,当传递带有修改行的 DataRow 集合时,Update 需要有效的 UpdateCommand
【发布时间】:2014-07-10 14:58:06
【问题描述】:

**强文本* 大家好 这是我的代码:

for(int i =0 ;i<listView1.Items.Count;i++)
        {
            if(listView1.Items[i].Checked)
            {
                DataRow dr = ds.Tables["EXPORT"].Rows[i];
                dr.BeginEdit();
                dr["MODE_PAIEMENT"] = "cheque";
                dr["SOLDE_RESTANT"] = "0";
                dr.EndEdit();
                //dt.AcceptChanges();
                //ds.Merge(dt);
                try
                {
                    connexion.da.Update(ds, "EXPORT");
                }
                catch (Exception x) {
                    MessageBox.Show(x.ToString());
                }

我有那个错误:当传递带有修改行的 DataRow 集合时,更新需要一个有效的 UpdateCommand。我该怎么办!! !

【问题讨论】:

    标签: c# windows-mobile-6 sql-server-ce-3.5


    【解决方案1】:

    您需要按照它所说的去做,并使用您的 SQL UPDATE 语句设置 DataAdapterUpdateCommand 属性。

    SqlDataAdaptor.UpdateCommand property

    SqlCommand updateCmd = new SqlCommand();
    updateCmd.CommandText = "UPDATE table SET col=@val";
    
     connexion.da.UpdateCommand = updateCmd;
    

    【讨论】:

      猜你喜欢
      • 2010-10-09
      • 1970-01-01
      • 2010-12-23
      • 2013-09-05
      • 2011-05-05
      • 2016-04-18
      • 2016-01-13
      • 2016-10-11
      相关资源
      最近更新 更多