diff --git a/URLNotesGrabberCORE/DataAccess.cs b/URLNotesGrabberCORE/DataAccess.cs index e7fb1b3..8536ddb 100644 --- a/URLNotesGrabberCORE/DataAccess.cs +++ b/URLNotesGrabberCORE/DataAccess.cs @@ -194,7 +194,9 @@ namespace URLNotesGrabberCORE { connection.Open(); - string sql = "INSERT INTO DailyAPICount (Date) values(@date)"; + // Use INSERT OR IGNORE to avoid UNIQUE constraint errors when the date row already exists. + // Also explicitly initialize APICount to 0 in case the table has no default. + string sql = "INSERT OR IGNORE INTO DailyAPICount (Date, APICount) values(@date, 0)"; using (SQLiteCommand command = new SQLiteCommand(sql, connection)) { command.Parameters.AddWithValue("@date", DateTime.Today.ToShortDateString());