我有一种方法是调用MySQL过程。以下是部分程序:
SELECT AR.alert_id AS AlertId,
AR.rule_id AS RuleId,
AR.name AS RuleName,
AR.rule_type AS RuleType,
AR.description AS Description,
(SELECT group_concat(occured_event_id separator ', ')
FROM alert_rule_event
WHERE alert_rule_id = AR.id) AS OccuredEventIds,
FROM alert_rule AR
C#代码:
alertRuleEntity.AlertId = Convert.ToInt32(dtAlertRuleEntityList.Rows[index]["AlertId"]);
alertRuleEntity.RuleId = Convert.ToInt32(dtAlertRuleEntityList.Rows[index]["RuleId"]);
alertRuleEntity.RuleName = Convert.ToString(dtAlertRuleEntityList.Rows[index]["RuleName"]);
alertRuleEntity.RuleType = Convert.ToString(dtAlertRuleEntityList.Rows[index]["RuleType"]);
alertRuleEntity.Description = Convert.ToString(dtAlertRuleEntityList.Rows[index]["Description"]);
alertRuleEntity.OccuredEventIds = Convert.ToString(dtAlertRuleEntityList.Rows[index]["OccuredEventIds"]);
它返回值如下:
它能够正确读取所有列值。但是在列的情况下,OccuredEventIds
它给出的值System.Byte[]
而不是它的实际值。可能是什么问题呢?