DataTable datatable = new DataTable(); Connection(); datatable.Load(new SqlCommand("select * from StudentMarksHistory", cs).ExecuteReader()); dataGridView1.DataSource = datatable.DefaultView; cs.Close();
foreach (DataGridViewRow row in dataGridView1.Rows) { mailBody +="<tr>"; foreach (DataGridViewCell cell in row.Cells) { mailBody +="<td stlye='color:blue;'>" +cell.Value + "</td>"; } mailBody +="</tr>"; } mailBody +="</table>"; //your rest of the original code mail.Body = mailBody; string mailBody = "<table width='100%' style='border:Solid 1px Black;'>";
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)