how does one get csharp-sqlite to throw exceptions for duplicates or foreign key constraint violations -


i making use of csharp-sqlite. in sqlite database have uniqueness , foreign key constraints. when write "duplicate" table exception not raised , way found check exception use following:

var error = sqlitecommand.getlasterror(); 

i hoping able following:

var sqlstring = "some insert sql"; var command = sqlitecommand(sqlstring); command.parameters.add(... parameter...);  using (var sqlconnection = new sqliteconnection(connectionstring)) {      try      {           command.executenonquery();      }      catch (exception ex)      {           exception      }           {           sqlconnection.close();      } } 

the "catch" block never hit, though

var error = sqlitecommand.getlasterror(); 

does return description of error expecting. have idea how solve this, or standard practice using csharp-sqlite library?


Comments

Popular posts from this blog

node.js - Mongoose: Cast to ObjectId failed for value on newly created object after setting the value -

[C++][SFML 2.2] Strange Performance Issues - Moving Mouse Lowers CPU Usage -

ios - Possible to get UIButton sizeThatFits to work? -