What is the best way to process a list of phone numbers in the where condition? Use a simple loop? Or is it possible to modify the Sql query for MS SQL Server somehow?
string sqlExpression = @'select d.* from MobilePhone m
join User u on m.User_IDREF = u.User_ID
join Device d on u.User_ID = d.User_ID
WHERE m.MonilePhone = @MobilePhone;' // I want to insert a list '+7897654321' AND '+7878765444' AND so on...
SqlConnection connection = new SqlConnection(connectionString);
try
{
await connection.OpenAsync();
SQLCommand command = new SqlCommand(sqlExpression, connection);
command.Parameters.Add("@MobilePhone", SqlDbType.VarChar);
command.Parameters["@MobilePhone"].Value = ''; // I want to insert a list '+7897654321' AND '+7878765444' AND so on... Maybe to use a loop for this?
SqlDataReader reader = await command.ExecuteReaderAsync();
}