この問題を解決するにはどうすればよいですか?ここでLINQ to Entitiesは、 'System.String get_Item(System.String)'メソッドを認識しません。
は私のコードです:私は取得しています
DateTime dtInicio = new DateTime();
DateTime dtFim = new DateTime();
Int32 codStatus = 0;
if(!string.IsNullOrEmpty(collection["txtDtInicial"]))
dtInicio = Convert.ToDateTime(collection["txtDtInicial"]);
if(!string.IsNullOrEmpty(collection["txtDtFinal"]))
dtFim = Convert.ToDateTime(collection["txtDtFinal"]);
if (!string.IsNullOrEmpty(collection["StatusCliente"]))
Convert.ToInt32(collection["StatusCliente"]);
var listCLientResult = (from c in db.tbClientes
orderby c.id
where (c.effdt >= dtInicio || string.IsNullOrEmpty(collection["txtDtInicial"]) &&
(c.effdt <= dtFim || string.IsNullOrEmpty(collection["txtDtFinal"])) &&
(c.cod_status_viagem == codStatus || string.IsNullOrEmpty(collection["StatusCliente"])))
select c);
return View(listCLientResult);
エラーがある:エンティティへ
LINQは、どれができない、方法 '可能System.String get_Item(可能System.String)' を認識しません。リポジトリの表現に変換することができます。
この答えを見てみてください。 http://stackoverflow.com/questions/7259567/linq-to-entities-does-not-recognize-the-method グリーティング – MUG4N
はい、推奨される質問をご覧ください。その理由はエラーが発生した理由です。http://stackoverflow.com/a/5541505/1109444では、動作中のクエリを作成する方法が説明されています。 – Hari
[LINQ to Entities]の複製がSystem.String ToString()メソッドを認識しません](http://stackoverflow.com/questions/4121863/linq-to-entities-does-not-recognize-the- method-system-string-tostring-method) –