问题标签 [datacolumn]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
1 回答
1851 浏览

c# - 使用 DataRelation 组合两个数据表的问题

您好我正在尝试组合以下两个数据表,代码没有出错,但它没有在输出中组合它们。我在这条线上遇到了麻烦:

代码:

0 投票
4 回答
129513 浏览

c# - 来自 DataRow 的 DataColumn 名称(不是 DataTable)

我需要从特定行迭代列名和列数据类型。我见过的所有示例都迭代了整个数据表。我想将一行传递给一个函数来做一堆条件处理。为了便于阅读,我想将条件处理分开。

这就是我所拥有的:

返回的错误是

System.InvalidCastException:无法将“System.String”类型的对象转换为“System.Data.DataColumn”类型。

我将如何从行中获取列名,或者我别无选择,必须将整个数据表传递给函数?

0 投票
3 回答
4364 浏览

c# - Set a specific column in a DataRow

I'm trying to perform a "bulk" insert a set of rules into a table of rules. The table has the following structure:

In my insertion function I try to set the columns of a row after I've obtained the schema of the table, but it appears that the row does not contain the specified column (note that I don't specify the RuleId since it's auto-generated):

Here is the function that gets the schema for the specified table:

Problem: When I try to set the specific column it tells me that the column doesn't exist.
Exception Message:

I suspect that the getting the table schema does not actually give me Rule table, but the SchemaTable. What I really want to get is the DataTable which corresponds to the Rule table (i.e. it has the same schema).

Question: What's the proper way to set the column values in a row given a list of records?

0 投票
0 回答
577 浏览

c# - 如何处理 DataColumn 的 NullValue 属性引发的异常?

我有一个使用向导制作的数据集。此 DataSet 具有 ID 列的 DataTable,其 NullValue 属性设置为(引发异常)。如何在代码中处理这种异常?例如显示我的信息或做其他事情。

0 投票
6 回答
23058 浏览

c# - 为什么 DataColumn.Caption 不起作用?

我正在尝试创建 aDataTable并将其绑定到DataGridView. 它可以工作,但我无法通过该Caption属性设置列标题。ColumnName它使用("City") 代替显示标题。MSDN

“您可以使用 Caption 属性来显示 DataColumn 的描述性或友好名称。”

这是我的代码:

0 投票
1 回答
434 浏览

vb.net - 如何在 VB.Net 中测试 mdb 列类型

我有以下代码

在“For Each”内部,我想测试各种列数据类型并以不同方式处理它们。我以前只使用:dbText、dbMemo、dbDate。您如何在 VB.net 中编写此“If”语句?

0 投票
1 回答
347 浏览

c# - NameValueCollection.Get() 替代 DataRow

我可以安全地从NameValueCollectionusing获取值NameValueCollection.Get(),如果键不存在,则返回 null。

然而很多时候我想尝试加载一个DataColumn值,不幸dr["BadColumn"] 的是会抛出一个异常。

有没有比创建检查方法更简单的方法?

0 投票
2 回答
3165 浏览

c# - 将一个数据行拆分为多个数据行

我有一个包含 3 列的数据表:

我想拆分这一行以获得 3 行:

0 投票
0 回答
258 浏览

.net - 有没有办法在.Net Datacolumn Expression Properties 中执行 Count If 或 Count Where ?

我正在使用一个报告工具,它允许我使用 .Net 数据列表达式属性来创建计算字段/标题。我正在尝试创建一个计算字段,该字段将告诉我有多少记录的销售额 > 100 美元。

- 我使用 sum(sales) 创建销售摘要的标题之一,计算所有销售额的总和。

- 另一列我对记录数(recordid)进行了计数。

-我还可以使用 IF 语句创建一个名为 STATUS 的列,以显示记录的销售额是否大于 100,如果销售额大于 100,则使用 IIF(SALES>100, 1, 0) 将显示 1 或0 如果不是

但到目前为止,我不知道如何计算销售额 > 100 的记录数。如果我运行一个简单的 sum(STATUS),我会收到一条错误消息:聚合函数 Sum() 和类型的使用无效:字符串。

如何实现创建销售额百分比高于 100 美元的列的目标?

谢谢!

0 投票
2 回答
346 浏览

jsf - 根据参数对 p:dataTable 中的特定列进行排序

我必须显示Student表中的数据<p:dataTable>,如下所示:

在这里,school.getStudent(MALE)将返回所有男学生school.getStudent(FEMALE)的列表,并将返回所有女学生的列表。

现在我面临的问题是订购数据。要求是:

  • 如果是MALE,则根据ID
  • 如果是FEMALE,则根据NAME

ID并且NAME是表格的列Student

我怎样才能做到这一点?