I´working on a C# desktop App and want to search in a MYSQL database all the records that match with a specific name in order to display this records into a datagridview but got the error when executing the query with the value: pablo
this is my query
sentencia = "select * from registro where nombreParticipante LIKE '%' + @valor + '%'";
nombre = valor.ToUpper();
cmd.Parameters.AddWithValue("@valor", nombre);
cmd.CommandText = sentencia;
Format the string for your parameter rather than in the query:
sentencia = "select * from registro where nombreParticipante LIKE @valor";
nombre = valor.ToUpper();
cmd.Parameters.AddWithValue("@valor", "%" + nombre + "%");
cmd.CommandText = sentencia;