Ekrem Tapan

Ekrem Tapan

  • NA
  • 967
  • 81.7k

asp.net avoid duplicates in string builder

May 19 2015 10:40 PM
hello everbody, i have a some problem on my code,

i want get data from mssql, after get data put my table inside but i have a some problem,same data getting two times<br>


StringBuilder sb = new StringBuilder();

foreach (Coffee coffee in coffeeList)
{
sb.Append(string.Format(@"<table>
<tr>
<td rowspan='6'><img runat='server' src='{6}' /></td>
<td>Name :</span></td>
<td>{0}</td>
<td rowspan='6'><img runat='server' src='{6}' /></td>
<td>Name :</span></td>
<td>{0}</td>
</tr>
<tr>
<td>Type:</td>
<td>{1}</td>
<td>Type:</td>
<td>{1}</td>
</tr>
<tr>
<td>Price:</td>
<td>{2}</td>
<td>Price:</td>
<td>{2}</td>
</tr>
<tr>
<td>Roast:</td>
<td>{3}</td>
<td>Roast:</td>
<td>{3}</td>
</tr>
<tr>
<td>Origin:</td>
<td>{4}</td>
<td>Origin:</td>
<td>{4}</td>
</tr>
<tr>
<td>Description:</td>
<td>{5}</td>
<td>Description:</td>
<td>{5}</td>
</tr>

</table>",
products.Name, products.Type, products.Price, products.Roast, products.Country, products.Review, products.Image));

}
 
 

Answers (2)