[Dotnet core 5] Probleme de recuperation de données avec data.SQLCLient pour mon Api
Bonjour,
Je travail sur une API et j'ai un problèeme de recuperation de données.
Quand je fait un select tout simple, sans condition, j'arrive a tout récuperer et quand je rajoute une condition, rien ne remonte de ma BD.
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
|
requete = "select champ1, champ2 from table where champ1 = '12345678' "
using (SqlConnection conn = new SqlConnection(connectionString.DefaultConnection))
{
using (SqlCommand sqlCmd = new SqlCommand(requete, conn))
{
conn.Open();
using (SqlDataReader reader = sqlCmd.ExecuteReader())
{
while (reader.Read())
{
dossier = new Dossier
{
champ1 = reader.GetString(0),
champ2= reader.GetString(1),
};
}
}
}
} |
merci d'avance