I'm trying the show some data from my table by clicking on a link label, but when i launch the application, i have some error like : Object does not contain a definition of tag and no accessible extension methode error
Error line : int appID = (LinkLabel)sender.Tag;
Code you please help me to fix this error or if you have other idea to get the ID
Here is My code :
private void ShowAppointmentDetail(object sender, EventArgs e)
{
int appID = (LinkLabel)sender.Tag;
SqlCommand sql = new SqlCommand("select * from RDV whereID_RDV = {appID}");
DataTable dt = new DataTable();
SqlDataAdapter sda = new SqlDataAdapter(sql);
sda.Fill(dt);
if (dt.Rows.Count > 0)
{
DataRow row = dt.Rows[0];
{
frmManageAppointment withBlock = new frmManageAppointment();
withBlock.Nom.Text = row["Nom"].ToString();
withBlock.Prénom.Text = row["Prénom"].ToString();
withBlock.NUM.Text = row["Num"].ToString();
withBlock.date.Text = row["DateRDV"].ToString();
withBlock.ShowDialog();
}
DisplayCurrentDate();
}
}
Thank you