从 oldValues IOrderedDictionary 获取列名

发布于 2024-08-14 06:46:29 字数 239 浏览 4 评论 0原文

我了解 FormViewUpdatedEventArgs 的 oldValues 属性包含用于更新的字段名称/值对。我当然可以使用例如 e.OldValues(x) 访问这些值 - 因为默认成员已在系统中声明。但是在这种情况下如何提取列/字段名称?

我尝试将 oldValues(x) 转换为字典条目 - 以拉动 .key 字段,但不允许进行转换。

我想我在这里遗漏了一些基本的东西 - 有什么指示吗?

干杯! :D

I understand that the oldValues property of FormViewUpdatedEventArgs contains field name/value pairs for an update. I can certainly access the values using for example e.OldValues(x) - because the default member has been declared in the system.. but how can I pull out the column/field name in this case?

I've tried casting oldValues(x) as a dictionaryentry - with a view to pulling the .key field but that cast is not allowed.

I guess I'm missing something fundamental here - any pointers, please?

Cheers! :D

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

游魂 2024-08-21 06:46:29

试试这个:

                    ICollection colKeys = e.OldValues.Keys;
                    ICollection colValues = e.OldValues.Values;

                    string keys = string.Empty;
                    string values = string.Empty;

                    foreach (object obj in colKeys)
                    {
                        keys += obj.ToString() + "|";
                    }

                    foreach (object obj in colValues)
                    {
                        values += obj.ToString() + "|";
                    }

您可能需要以下导入:

using System.Collections;
using System.Collections.Specialized;

Try this:

                    ICollection colKeys = e.OldValues.Keys;
                    ICollection colValues = e.OldValues.Values;

                    string keys = string.Empty;
                    string values = string.Empty;

                    foreach (object obj in colKeys)
                    {
                        keys += obj.ToString() + "|";
                    }

                    foreach (object obj in colValues)
                    {
                        values += obj.ToString() + "|";
                    }

You may need the following imports:

using System.Collections;
using System.Collections.Specialized;
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文