Fehler berichtigt

This commit is contained in:
Jonas Schönbach 2020-05-29 11:30:38 +02:00
parent 89fcf8abd2
commit 6ce6c92210

View file

@ -21,19 +21,17 @@ namespace BuecherwurmAPI.Data
{
using (var command = _dbConnection.CreateCommand())
{
var com = _dbConnection.CreateCommand();
com.Parameters.Add(new SqliteParameter("@Id", SqliteType.Integer)).Value = id;
command.Parameters.Add(new SqliteParameter("@Id", SqliteType.Integer)).Value = id;
// Certain parts of the query can't be filled with variables for security reasons.
switch (table)
{
case Tables.Table.Lends:
com.CommandText = @"SELECT EXISTS(SELECT 0 FROM Lends WHERE Id = @Id)";
command.CommandText = @"SELECT EXISTS(SELECT 0 FROM Lends WHERE Id = @Id)";
break;
}
var dr = com.ExecuteReader();
var dr = command.ExecuteReader();
long result = 0;
while (dr.Read())