I want to replace a string with a new value through a SqlDataReader, but the DataReader return 2 values, 2 and 4, the replacement works fine, replace the string with the value 2, but no with the 4 value.
First i create a List from a class, then i add the values of the DataReader to the List:
listaTan.Add(new ListaTan { Tanques = dr["Num"].ToString() })
Then i use a for loop to replace the string:
for (int i = 0; i < listaTan.Count; i++)
{
body = body.Replace("#Num#", listaTan[i].Tanques);
}
But always replace the first value and no the second.
The purpose is to send emails with the two values, ie send 2 emails, 1 email with the value 2 and another with the value 4.
Now, I send 2 emails but always with value 2 and no for the other values, because of the replace it doesn't work properly.
Thank You