The project uses a SQLite database, and the sqlite-net library is used to work with it. The table has the form:

id | tag | text 

The first field is an auto-increment id , the second is a text field filled in, the third field is also text, empty.

Task: in a certain place (according to the corresponding id or tag ) make an entry in the text field.

Can this be implemented at all with the help of sqlite-net ? Or still need to resort to the use of requests? If so, what will be the request? PS: here is the class for working with the table, the AddData method simply adds an entry to the end of the table in the text field.

 public class data { [PrimaryKey, AutoIncrement] public int id { get; set; } public string tag { get; set; } public string text { get; set; } public data AddData (string Text) { //string dbPath; //string dbPath = Path.Combine(ApplicationData.Current.LocalFolder.Path, "products.db"); //dbPath = @" data source=C:/data.db; synchronous=Off "; var Data = new data() { text = Text }; using (var db = new SQLiteConnection("C:/data")) { db.Insert(Data); } return (Data); } } 

    1 answer 1

    For example, try this option with saving the record. Suppose that with 0 id we do not have a record, and with 1 and above we have an update of existing records. By analogy, you can make a method with additional, necessary conditions for recording.

     public int SaveItem (Data item) { using (var databaseConnection = new SQLiteConnection("C:/data")) { if (item.id > 0) { databaseConnection.Update(item); return item.id; } else { return databaseConnection.Insert(item); } } }