Page 1 of 1

Visual Studio DB access

Posted: Tue Sep 07, 2021 12:52 pm
by Ski6
As the regexp script does not seem forthcoming, I wanted to see if I could do db updates in VS using SQL calls.

I stumbled past the collation thing for WHERE statements in SELECTs using COLLATE NOCASE for strings, but have had no luck doing UPDATES:
using (SQLiteConnection connection = new SQLiteConnection(constr))
{
string updateQuery = @"UPDATE main.Songs SET SongTitle = @SongTitle WHERE ID = @ID";
var result = connection.Execute(updateQuery, new
{
ID = 320923,
SongTitle = "A different song title"
});
}

This yields a collate error and I can't guess what it wants.
Does anyone know a way to do an SQL UPDATE to the Songs DB? Entity framework? Dapper?

Re: Visual Studio DB access

Posted: Tue Sep 07, 2021 3:32 pm
by TIV73
There have been a couple of threads where people reported having issues writing to the database (see here and here), so external tool access might not be a thing atm.

Re: Visual Studio DB access

Posted: Tue Sep 07, 2021 8:00 pm
by Peke
Simply Use Sample Script "SQLeditor" eg. copy from Sample scripts to Scripts.

You can also use that Script to cannibalize what you need for your APP.

Only difference is taht you do not open SQLite Connection but rather thru https://www.mediamonkey.com/webhelp/MM5 ... es/DB.html

Re: Visual Studio DB access

Posted: Tue Sep 07, 2021 11:08 pm
by Ski6
Thanks Peke! That is very helpful.

Re: Visual Studio DB access

Posted: Wed Sep 08, 2021 5:47 am
by Peke
Hi,
My pleasure. I am curious what you will think of as I had no time to play around much with MM5 API lately.