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
Post a Comment