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 29 30 31 32 33 34 35 36 37 38 39 40 41
|
foreach (DataGridViewRow row in dataGridView1.Rows)
{
if (row.Cells[0].Value == null || (row.Cells[0].Value.ToString().Trim() == ""))
{
}
else
{
if (row.Cells[0].Value.ToString().Contains(someString)) // someString est le steamid récupéré
{
if (row.Cells[2].Value == null || (row.Cells[2].Value.ToString().Trim() == ""))
{
}
else
{
if (row.Cells[2].Value.ToString().Contains(result)) // result est la date de la ligne pour les tests
{
MessageBox.Show(System.Convert.ToString(row.Index));
dt1.ImportRow(dtData.Rows[row.Index + 1]);
//string query = string.Format("[Steam ID] = '{0}' AND [Date de Connexion] = '{1}'", row.Cells[0].Value, row.Cells[2].Value);
//string query = "SteamID = '"+ row.Cells[0].Value+ "' AND Date de Connexion IN (#" + row.Cells[2] + "#"; // dates a remplacer bien sur par tes dates
string query2 = "[Steam ID] = '" + row.Cells[0].Value + "' AND [Date de Connexion] Like ('%" + result + "%')";
dtview.RowFilter = query2;
MessageBox.Show(System.Convert.ToString(dtview));
dtData2.Rows.Add(dtview.ToTable());
//dtData2 = dtview.ToTable(); ne marche pas
dtData2.AcceptChanges();
}
}
}
}
dataGridView3.DataSource = dtData2;
} |
Partager