ZVenue
ZVenue

Reputation: 5027

Format exception - RavenDB LINQ query

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.

Exception:

FormatException was unhandled by user code:
"Input string was not in correct format"

Code:

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

Upvotes: 0

Views: 197

Answers (1)

Ayende Rahien
Ayende Rahien

Reputation: 22956

The problem is inside string.Format, You need the value to be:

    {{* TO {0}}}

In other words, you need to escape the { }

Upvotes: 2

Related Questions