如何将DataRow类设置为Sql表的最后一行 [英] How do i set DataRow class to last row of a Sql table
问题描述
我必须使用C#将值添加到表的最后一行中的空字段。
我应该对以下代码做出哪些更改,以便我可以将''thisRow''设置为表格中的最后一行而不是新行。
DataRow thisRow = thisDataSet.Tables [" Table"] .NewRow();
thisRow [" Exit_time"] = Exittime;
thisDataSet .Tables [" Table"]。Rows.Add(thisRow);
I have to add a value to an empty field in the last row of the table using C#.
What changes should i make to the following code so that i can set ''thisRow'' to last row in the table rather than to a new row.
DataRow thisRow = thisDataSet.Tables["Table"].NewRow();
thisRow["Exit_time"] = Exittime;
thisDataSet.Tables["Table"].Rows.Add(thisRow);
推荐答案
行包含数据。如果他们不是,他们就不是真的。
A空行在表的末尾只是一个用于填充新行的模板。
断言你在每一列中都允许空值并创建一个除了空值之外什么都没有的行并且不要t有任何自动递增字段,没有主键。
Rows contain data. If they don''t, they aren''t real.
A "blank row" at the end of the table is just a template for filling in a new row.
Unluess you allow nulls in every column and create a row with nothing but nulls in it and don''t have any auto-incrementing fields and no primary key.
行包含数据。如果他们不是,他们就不是真的。
A空行在表的末尾只是一个用于填充新行的模板。
断言你在每一列中都允许空值并创建一个除了空值之外什么都没有的行并且不要t有任何自动递增字段,没有主键。
Rows contain data. If they don''t, they aren''t real.
A "blank row" at the end of the table is just a template for filling in a new row.
Unluess you allow nulls in every column and create a row with nothing but nulls in it and don''t have any auto-incrementing fields and no primary key.
我想你误解了我说的话。在我的表中,最后一行在每列中都有数据,除了1列,它允许为null。现在我需要在最后一行的这一列中插入值。此列的值将是c#程序的输出。
I guess you misunderstood what i said. In my table the last row has data in every column except for 1 column, which allows null. And now i need to insert value into this column in the last row. The value of this column will be a output of the c# program.
Scracth。
您想要将数据输入到数据表的最后一行中代码?
您应该可以这样做吗?
Scracth that.
You want to enter the data into the last row of a datatable in code?
You should be able to do this?
这篇关于如何将DataRow类设置为Sql表的最后一行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!