我有一個方法是調用MySQL程序。下面是程序的一部分:Convert.ToString返回`System.Byte []`而不是實際的數據作爲GROUP_CONCAT返回BLOB
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[]
,而不是其實際值。可能是什麼問題呢?
該列的數據類型是什麼?它看起來是某種二進制類型。 – 2013-05-13 08:07:05
occured_event_id是INT類型。但是程序正在返回逗號分隔的ID。 – Ajinkya 2013-05-13 08:10:09
分享您編寫的一些C#代碼以讀取PROC中的數據... – Pandian 2013-05-13 08:11:54