C#C
C#16mo ago
Hazzza

SQL help

When trying to update a value in my database I get the error
No value given for one or more required parameters.

however I heard this is common and usually means the SQL statement is wrong

Here is my SQL string

C#
string _sSqlString = $"UPDATE Product SET SellPrice = {SellPrice} WHERE ProductName = {ProductName}";

databaseUtils.ExecuteSqlQuery(_sSqlString);

After inputting the variables into the Sql it looks like this
C#
UPDATE Product SET SellPrice = 9 WHERE ProductName = apple

A picture of the database is attached

The ExecuteSqlQuery method works as intended, at least for all my other SQL requests, however they all use either DELETE, INSERT or SELECT

Thanks
image.png
Was this page helpful?