エラー「Cannot perform '=' operation on System.Double and System.String.」について

「地域」列から「不明」という値をカウントする処理で、
「Cannot perform ‘=’ operation on System.Double and System.String.」
と、いうエラーが発生し、解決方法を教えていただきたいです。

シナリオでは、代入アクティビティで以下のように設定しています。
intCount = dt.Select(“[地域]=‘不明’”).Count

他の値をカウントする時は、上記の設定で
正しくカウントできます。

Hi @k.m

Try this:

intCount = dt.AsEnumerable().Count(Function(row) row.Field(Of String)("Region") = "Unknown")

Hope it helps!!

@k.m

intCount = dt.AsEnumerable().Where(Function(row) row("Region").ToString() = "Unknown").Count()

こんにちは

地域列に数値データが含まれているからですね。以下お試しください。

dt.Select("Convert([地域],System.String)='不明'").Count

教えていただいた通りに設定すると、
「不明」という文字列のカウントができました。
「不明」という値だけがカウントできないで
他の値(文字列)がカウントできていたので、非常に助かりました。
ありがとうございます。

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.