Wie verwende ich IF/ELSE-oder CASE-In DataColumn.Ausdruck?

Ich habe eine Tabelle mit 1 Spalte: "Status"
Möchte ich hinzufügen, dass in einer anderen Spalte mit dem Namen 'Action', ist sein Wert wie folgt: wenn Status = 'ja', Dann Action = "Go", ansonsten Aktion = 'Stop'. Ich habe diesen folgenden code zum hinzufügen in der Spalte 'Action', aber es hat nicht funktioniert:

myDataTable.Columns.Add("Action", typeof(string), "IF [Status] = 'Yes' THEN 'Go' ELSE 'Stop' END");

InformationsquelleAutor J - C Sharper | 2013-10-11

Schreibe einen Kommentar