0
I have a simple gridview:
A sql datasource to bind data from table data to gridview.

在 gridview 行更新时,我想从当前编辑行的某些列中清除单元格值,因此这些值也应该从表数据中删除。我怎样才能做到这一点?

就像是:

SqlDataSource1.DeleteCommand = "Delete value from column1,column2 where rowid=@rowid"; //I need the right statment
SqlDataSource1.Delete();
4

1 回答 1

3

我认为这里有一些令人困惑的地方。如果要“删除” 2 列值,则可以简单地将它们设为 null :

 UPDATE table
    SET column1 = null,
        column2 = null
  WHERE rowid = @rowid;

或者只是删除整行

DELETE FROM table
WHERE rowid = @rowid;
于 2012-04-26T12:01:33.197 回答