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
Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2