0

我在以下代码中收到输入字符串格式错误...在调试代码时,它作为单行代码运行,因此我无法深入研究可能导致格式异常的原因...可以请指出我做错了什么..谢谢。

例外:

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);
4

1 回答 1

2

问题出在 string.Format 内部,您需要的值为:

    {{* TO {0}}}

换句话说,您需要转义 { }

于 2012-04-23T04:34:46.780 回答