0

I want to use query parameters in my update sql, and had this code:

internal static int UpdatePhotosetName(string oldPhotosetName, string newPhotosetName)
{
    String qryUpdateBaseTable = "UPDATE PhotraxBaseData SET photosetName = @newName WHERE photosetName = @oldName";
    int rowsUpdated;
    using (var db = new SQLite.SQLiteConnection(App.DBPath))
    {
        SQLiteCommand cmd = new SQLiteCommand(db);
        cmd.CommandText = qryUpdateBaseTable;
        cmd.Parameters.Add(new SQLiteParameter("@newName"));
        cmd.Parameters.Add(new SQLiteParameter("@oldName"));
        Command.Parameters["@newName"].Value = newPhotosetName;
        Command.Parameters["@oldName"].Value = oldPhotosetName;
        rowsUpdated = cmd.ExecuteNonQuery();
        db.Close();
    }
    return rowsUpdated;
}

...but all of the following were flagged as being unavailable/nonexistent in the current context:

Parameters
SQLiteParameter
Command

I do have Sqlite-Net installed (SQLite.cs and SQLiteAsync.cs), and version 3.8.7.1 of "SQLite for Windows Runtime (Windows 8.1)"

I based this code on what I found here, but apparently the WinRT way of doing this differs significantly from the more staid way.

How can I utilize query parameters in a WinRT app?

Dharman
  • 30,962
  • 25
  • 85
  • 135
B. Clay Shannon-B. Crow Raven
  • 8,547
  • 144
  • 472
  • 862

1 Answers1

2
db.Execute("UPDATE PhotraxBaseData SET photosetName = ? WHERE photosetName = ?", newName, oldName);
Thomas Levesque
  • 286,951
  • 70
  • 623
  • 758