NullReferenceException when running query in Vici CoolStorage

159 views Asked by At

Here is my code :

BookMark[] st = CSDatabase.RunQuery<BookMark>(
            @"SELECT * FROM Bookmark WHERE link='" + link + "'");

class BookMark
{
    public string link;
}

Sometimes I get a NullReferenceException but I don't why.

Please help me!

2

There are 2 answers

0
Jose Carrillo On

If you are using a sqlite Database the problem is due to the sqlite database set to an encoding other than UTF-8. Just create a new sqlite database in the UTF-8 encoding and the error will go away.

0
ctacke On

You've given us almost nothing to go by. I'd guess you get the exception because the link variable in your code is null.