I am getting error in simple in
operator on MySQL - 5.7.mysql_aurora.2.07.2
on AWS RDS.
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''[1]''
Code
public async Task<IEnumerable<User>> GetUsersAsync(long[] user_ids)
{
using MySqlConnection connection = new MySqlConnection(rdsConnection);
const string sqlQuery = @"Select user_id, user_name From Users Where user_id in @Ids";
var result = await connection.QueryAsync<User>(sqlQuery, new
{
Ids = user_ids
});
return result;
}
Stack trace
MySql.Data.MySqlClient.MySqlException (0x80004005): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''[1]'' at line 5
at MySql.Data.MySqlClient.MySqlStream.ReadPacket()
at MySql.Data.MySqlClient.NativeDriver.GetResult(Int32& affectedRow, Int64& insertedId)
at MySql.Data.MySqlClient.Driver.GetResult(Int32 statementId, Int32& affectedRows, Int64& insertedId)
at MySql.Data.MySqlClient.Driver.NextResult(Int32 statementId, Boolean force)
at MySql.Data.MySqlClient.MySqlDataReader.NextResult()
at MySql.Data.MySqlClient.MySqlCommand.ExecuteReader(CommandBehavior behavior)
at MySql.Data.MySqlClient.MySqlCommand.ExecuteDbDataReader(CommandBehavior behavior)
at System.Data.Common.DbCommand.ExecuteDbDataReaderAsync(CommandBehavior behavior, CancellationToken cancellationToken)
--- End of stack trace from previous location ---
at Dapper.SqlMapper.QueryAsync[T](IDbConnection cnn, Type effectiveType, CommandDefinition command) in /_/Dapper/SqlMapper.Async.cs:line 418
User contributions licensed under CC BY-SA 3.0