LinQを使って列の中身を更新する方法について

いつもお世話になっております。

以下のForumの記事を読んで、DTの列のボディをLinQで一括で置換したいと思っています。

コードをそのままコピーしたのですが、以下のようなエラーが出てしまいます。
「'Field’は’Char’のメンバーではありません」

image

何が問題なのでしょうか?

1 Like

Hi
Use this expression pls
datatable = datatable.Asenumerable().Select(Function(a) a.Field(of string)(“yourcolumnname”).ToString.Replace(“-###”,“”)).CopyToDatatable()

Cheers @saintseiyer

Hi, Thank You.
I’ve tried it. But it occured error about it.
image

CopyToDataTable is not a member of 'System.Data.EnumberableRowCollection(Of String)
variable of datatable is DataTable.

what is probolem?

Fine
While typing did AsEnumerable came next to Datatable.

If not kindly ensure that this assembly reference is added to the xaml
Open main.xaml in notepad and include as mentioned in this thread

Cheers @saintseiyer

1 Like

Thank you to reply.
I checked if Assembly Reference is disappeare, But it existed.
So I tried to restart project file, But I could’nt

If you have a few minute, Can you look my project folder?
LinQ.zip (16.0 KB)

こんにちは

VB.netですと、代入演算子と等値演算子が同じなので、このようなシーンで困るんですよね。

取り急ぎのワークアラウンドとしてInvoke Codeで例えば以下のように記述すると通ると思うので、一度こちらをお試しいただければと思います。(複数行にして記述すると代入演算子として認識されます。)

img20200203-1

2 Likes

Yoichi 様
いつも拝見させていただいております。
的確なコメントくださり、ありがとうございます。
無事に、Invoke Codeでデータ変換をすることができました。
ありがとうございます!!

1 Like

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