I am kinda new to C# and not sure what am I doing wrong. Tried to find a solution but failed. Thanks in advance.
When I do not use parameter "select * from Καρτέλα_Ασθενή"; the form will get populate with values from the reader. The form does not bring values in other words looks like the select command not working.
OleDbCommand cmd = new OleDbCommand();
cmd.CommandType = CommandType.Text;
cmd.CommandText = "select * from Καρτέλα_Ασθενή where Κωδ_Ασθενή = @Κωδ_Ασθενή";
cmd.Parameters.AddWithValue("@Κωδ_Ασθενή", MyGlobals.Patient_code);
cmd.Connection = accessdb;
accessdb.Open();
OleDbDataReader dr = cmd.ExecuteReader();
if (dr.Read())
{
while (dr.Read())
{
txt_patient_code.Text = dr["Κωδ_Ασθενή"].ToString();
txt_Surname.Text = dr["Επώνυμο"].ToString();
txt_Name.Text = dr["Όνομα"].ToString();
txt_date.Text = Convert.ToDateTime(dr["Ημερομηνία_Γέννησης"]).ToShortDateString();
txt_address.Text = dr["Διεύθυνση"].ToString();
txt_area.Text = dr["Περιοχή"].ToString();
txt_phone.Text = dr["Τηλ"].ToString();
txt_fax.Text = dr["Φαξ"].ToString();
txt_insurance.Text = dr["Ασφάλεια"].ToString();
txt_comments.Text = dr["Παρατηρήσεις"].ToString();
txt_history.Text = dr["Ιστορικό"].ToString();
txt_alergies.Text = dr["Αλλεργίες"].ToString();
txt_email.Text = dr["e-mail"].ToString();
}
}
dr.Close();
accessdb.Close();