我在下面的代码中得到输入字符串格式错误...在调试代码时,这只是一行代码运行,所以我无法深入研究可能导致格式异常的原因。任何人都可以指点我做错了什么..谢谢。
例外:
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);
答案 0 :(得分:2)
问题出在string.Format中,你需要的值是:
{{* TO {0}}}
换句话说,你需要逃避{}