hi,
i have this code which do search in Table1 and use the result of search to search in another datatable Table2:
SqlCeConnection conne = new SqlCeConnection();
conne.ConnectionString = @" Data source= |DataDirectory|\Database1.sdf";
conne.Open();
SqlCeDataReader rrs;
SqlCeCommand comd = new SqlCeCommand("select CodePersonne from Table1 where DateRP ='" + DateTime.Now.Date + "';", conne);
rrs = comd.ExecuteReader();
while (rrs.Read())
{
SqlCeDataReader rs;
SqlCeCommand cmd = new SqlCeCommand("SELECT [Nom],[Prenom],[DateNaissance] FROM Table2 where CodePersonne ='" + Convert.ToInt32(rrs["CodePersonne"].ToString()) + "';", conne);
rs = cmd.ExecuteReader();
SqlCeDataAdapter da = new SqlCeDataAdapter(cmd);
DataTable dtresullt = new DataTable();
da.Fill(dtresullt);
dataGridView1.DataSource = dtresullt;
}
the problem is that code show only one row in datagridview even there are many rows in Table1 which have the condition of the first query. iwish you can help me.