SterlingIndexNotFoundException

Apr 21, 2011 at 6:40 PM

Hi, 

i use where in my queries, but it  trigger the exception, any idea how to fix it ?

var noteList = (from k in SterlingService.Current.Database.Query<Notes, int, int>("categoryID")
                            where k.Index == categoryListID
                                     select k.LazyValue.Value);

            this.MainListBox.ItemsSource = noteList;

thanks

Coordinator
Apr 21, 2011 at 7:23 PM

Can you show us your table definitions? Did you name the index the exact same way you are using it (it is case sensitive) and remember to flush the database after saves?

Apr 22, 2011 at 4:01 AM

hi, yes i already flush after saving.

this is my table definition

protected override List<ITableDefinition> _RegisterTables()
        {
            return new List<ITableDefinition>
                       {
							CreateTableDefinition<Notes, int>(fh => fh.Id)
							   .WithIndex<Notes, string, int>("NotesName", notes => notes.noteName )
                               .WithIndex<Notes, int, int>("CategoryID", notes => notes.categoryID ),
                           CreateTableDefinition<Category, int>(fg => fg.Id)

                       };
        }

Coordinator
Apr 22, 2011 at 4:55 AM

Looks like you defined the index as "CategoryID" but are accessing it as "categoryID" that's why I show guidance in the user's guide of using a constant to keep it consistent.

Apr 22, 2011 at 5:22 AM

oh my god.

 

You Are Awesome.