thongaduka
thongaduka

Reputation: 627

NullReferenceException when running query in Vici CoolStorage

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!

Upvotes: 1

Views: 161

Answers (2)

Jose Carrillo
Jose Carrillo

Reputation: 11

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.

Upvotes: 1

ctacke
ctacke

Reputation: 67178

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.

Upvotes: 0

Related Questions