Today I tried to use SQLite database with my small WPF application, but I keep getting XamlParseException was unhandled. By taking out lines of code, I managed to notice that cmd.ExecuteNonQuery();causes the exception. In the rest, the SQLite connection seems working and also creating the database file.
public MainWindow()
{
InitializeComponent();
SQLiteConnection conn = new SQLiteConnection(@"Data Source=C:\Users\Vitas\Desktop\TimeCounter.sqlite");
conn.Open();
string commandText = "CREATE TABLE [EmpInfo]";
SQLiteCommand cmd = new SQLiteCommand(commandText, conn);
cmd.ExecuteNonQuery();
conn.Close();
}
Aucun commentaire:
Enregistrer un commentaire