Excel通过字段位置更新,而不是名称。此外,没有关键字段 [英] Excel update via field position, not name. Also, no key field

查看:90
本文介绍了Excel通过字段位置更新,而不是名称。此外,没有关键字段的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好,我正在尝试更新Excel电子表格中的行。我有两个问题。

1)没有真正独特的关键数据。我更新数据表中的第3行,第5行和第8行以及更新后写的内容。如果能让我更新,我可以重写整个工作表。

2)我们需要进行单值更改。我们有很多字段,我们的用户更改列的名称以满足他们的需要。因此,我们始终按位置访问列。例如,table.item(4)。我们怎样才能将这一变化写成一行。也就是说,有没有办法在SQL更新语句中引用列位置而不是名称。

谢谢,

Jerry

解决方案



1)要唯一地访问该行,您可以包含一个ID。

2)要访问特定列,您也可以使用columnName。例如

table.Rows [0 ] [



" ColumnName" ] // C#代码

或基于位置

table.Rows [0] [ 2 ] // C#代码 - 其中0是行,2是列。


Hi,

I am trying to update rows in an Excel spread sheet.  I have two issues.

1) The is no real unique key data.   I update the 3rd, 5th, and 8th row in the data table and what the updates written back. I can rewrite the entire sheet if it will let me update.

2) We will need to make single value changes.  We have a lot of fields and our users change the names of the columns to suit their needs.  Therefore we always access the columns by position.  For example, table.item(4).  How can we write this change a single row.  That is, is there a way to reference the column position, not the name, in the SQL update statement.

Thanks,

Jerry

解决方案

Hi,

1) To acccess the row uniquely, you can include a ID.

2) To access specific column you can use columnName as well. E.g

table.Rows[0][

"ColumnName"] // C# Code

or based on position

table.Rows[0][2] // C# Code - where 0 is the row and 2 is the column.


这篇关于Excel通过字段位置更新,而不是名称。此外,没有关键字段的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆