Answer the question
In order to leave comments, you need to log in
How to get the id value knowing one of the record parameters?
How to find out the record id knowing the variable in the record?
command = new SqlCommand("SELECT * FROM [Recent] WHERE [LibraryId] = @LibraryId", sqlConnection);//не знаю
byte _id = 0;
try
{
_id = Convert.ToByte(command.ExecuteScalar());
}
catch (Exception exc)
{
Console.WriteLine(exc.Message + " 2 " + exc.Source);
_id = 0;
}
finally
{
if (_id != 0)
{
command = new SqlCommand("DELETE FROM [Recent] WHERE [Id] = @Id", sqlConnection);
command.Parameters.AddWithValue("Id", _id);
await command.ExecuteNonQueryAsync();
}
}
Answer the question
In order to leave comments, you need to log in
command = new SqlCommand("SELECT [Id] FROM [Recent] WHERE [LibraryId] = @LibraryId", sqlConnection);
command.Parameters.AddWithValue("LibraryId", вашеЗначение);
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question