Fehler berichtigt

This commit is contained in:
Jonas Schönbach 2020-05-29 11:30:38 +02:00
parent 89fcf8abd2
commit 6ce6c92210
1 changed files with 3 additions and 5 deletions

View File

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