格式异常-RavenDB LINQ查询 [英] Format exception - RavenDB LINQ query
本文介绍了格式异常-RavenDB LINQ查询的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在以下代码中,我收到输入字符串格式错误...在调试代码时,它作为一行代码运行,因此我无法深入研究可能导致格式异常的原因.谁能指出我做错了..谢谢.
I am getting a input string format error in the following bit of code... While debugging code, this runs as a single line of code and so I am not able to dig deep into what might be causing the format exception.. can any one please point to me what I am doing wrong.. thank you.
例外:
FormatException was unhandled by user code:
"Input string was not in correct format"
代码:
store.DatabaseCommands.UpdateByIndex("Movies/NewIndexName",
new IndexQuery
{
Query =
string.Format("Status:Released AND IsDeleted:false AND ReleaseDate:{* TO {0}}",
DateTools.DateToString(new DateTime(2012, 4, 3),
DateTools.Resolution.MILLISECOND))
},
new[]
{
new PatchRequest
{
Type = PatchCommandType.Modify,
Name = "Status",
Value = "TestingReleased"
}
}, allowStale: false);
推荐答案
问题出在string.Format内部,您需要将值设置为:
The problem is inside string.Format, You need the value to be:
{{* TO {0}}}
换句话说,您需要转义{}
In other words, you need to escape the { }
这篇关于格式异常-RavenDB LINQ查询的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文