Сообщество IT-специалистов
Ответы на любые вопросы об IT
Профессиональное развитие в IT
Удаленная работа для IT-специалистов
System.Data.SQLite.SQLiteException: "database is locked database is locked"
try {} cache {}
PostData postData; if (isLiked) { var likesCount = conn.ExecuteReader("SELECT (Likes) FROM PostData AS pd WHERE pd.MessageId = @MessageId", new { messageId }).Parse<int>().FirstOrDefault(); conn.Close(); var temp = 1; if (likesCount > 0) { temp = likesCount++; } try { conn.Open(); conn.Execute("UPDATE PostData SET Likes = @Likes WHERE MessageId = @MessageId", new { Likes = temp, messageId }); //using (SQLiteCommand cmd = new SQLiteCommand($"UPDATE PostData SET Likes = '{temp}' WHERE MessageId = '{messageId}'", conn)) //{ // cmd.ExecuteNonQuery(); //} } catch (Exception ex) { Console.WriteLine(ex); throw; }