The exception that is generated when SQLite returns an error.
The following example generates a
SQLiteException due to a non-existing table, and then displays the exception.
public void ThrowSQLiteException()
{
string mySelectQuery = "SELECT * FROM NONEXISTINGTABLE";
SQLiteConnection sqConnection =
new SQLiteConnection(
"DataSource=mydatabase.db;");
SQLiteCommand sqCommand = new SQLiteCommand(mySelectQuery,sqConnection);
try
{
sqCommand.Connection.Open();
}
catch (SQLiteException myException)
{
MessageBox.Show("Message: " + myException.Message + "\n");
}
}
Public Sub ThrowSQLiteException()
Dim mySelectQuery As String = "SELECT * FROM NONEXISTINGTABLE"
Dim sqConnection As New SQLiteConnection( _
"DataSource=mydatabase.db;")
Dim sqCommand As New SQLiteCommand(mySelectQuery, sqConnection)
Try
sqCommand.Connection.Open()
Catch myException As SQLiteException
MessageBox.Show("Message: " + myException.Message + ControlChars.Cr)
End Try
End Sub