So from what I understand of your requirements when a user selects a patient you're retrieving the patient's information from a database. Then you're trying to put every time that select patient visited the hospital into the ComboBox_LastDayVisit combo box. What's happening instead is that you're only getting one day into the combo box. I would recommend putting a break point on the line ComboBox_LastDayVisit.Items.Add(dr["Date_of_Visit"] + ""); and seeing what the values of dr and ComboBox_LastDayVisit are at each step. It may surprise you to see what the values end up being at each step because I don't think your program is behaving as you think it is.
On Mar 27, 12:53 am, Hamad H <[email protected]> wrote: > the thing is In the Patient Appointment Form at the beginning I need > to retrieve the Major Info about the Patient before you register > his/her Appointment and when I do it .... I put a ComboBox to retrieve > the number of date(s) that this Patient has visited the > Clinic/Hospital and hence I can select the Last Day he/she visited the > clinic/hospital....... > > The_Fruitman thankx for the link but with this I'm displaying the > whole VISITDATES of all the patients and I did it before but I want to > display the Number of visited date(s) by the particular Patient ID > that I will submit into PatientID ComboBox because in this ComboBox I > bounded into the PatientID Column and I'm retrieving every registered > patient....... > > by the way here is the codes check it up........ if there is another > possible way and I know there is always a way to work things out in > .NET so plz dn't hesitate and I 'll be thank full > > LOGIC : > > private void Btn_Go_Click(object sender, EventArgs e) > { > try > { > cn.Open(); > > ComboBox_LastDayVisit.Items.Clear(); > ComboBox_LastDayVisit.Text = ""; > cmd = new SqlCommand("Select * from P_VisitReg where > P_ID =" + ComboBox_PID.Text, cn); > dr = cmd.ExecuteReader(); > if (dr.Read() == true) > { > lblInfo.Visible = false; > TxtP_Name.Text = dr.GetString(1); > TxtP_Gender.Text = dr.GetString(2); > TxtP_Age.Text = dr.GetInt16(3) + ""; > TxtP_HomeNum.Text = dr.GetInt64(4) + ""; > TxtP_CellNum.Text = dr.GetInt64(5) + ""; > TxtDr_Name.Text = dr.GetString(8); > ComboBox_LastDayVisit.Items.Add(dr["Date_of_Visit"] + ""); > > } > else > { > lblInfo.Visible = true; > lblInfo.Text = "Patient ID " + CB_PID.Text + " has > not registred for a visit"; > Clear(); > ComboBox_PID.Focus(); > } > } > catch (SqlException se) > { > MessageBox.Show(se.Message); > } > finally > { > dr.Close(); > cn.Close(); > } > } > > Thank a lot > > 2009/3/26, Cerebrus <[email protected]>: > > > > > > > I concur with The_Fruitman... we need to see a little more of the > > relevant code and we need to understand your table structure in more > > detail. For instance, what do you store in the "Patient Visit" table? > > How do you fill the Combobox? and so on... > > > On Mar 26, 11:35 am, Haitch <[email protected]> wrote: > >> I'm developing a project which is PSI (Patient Information System) and > >> in the appointment form There is two Panels > >> 1- Patient Major Information. PID, NAME, GENDER..... etc... > >> 2- Appointments Details. Date of App, Reason for App, Best Time to > >> Remind the Patient.... etc... > > >> hence in the major patient info I put a COMBOBOX to Retrieve the Dates > >> from ( Patient Visit TABLE ) using ADO.NET.... that the Patient has > >> already visited the Clinic... b'coz a Patient can visit the clinic as > >> much as his treatment needed for.... > > >> but when I tried it's just displaying only one DATE ....... here is > >> the way I did so for the ComboBox... > > >> ComboBox_VisitDate.Items.Add(dr[Visit_Dates] + " "); > > >> and according to the selected date it should display the ( Patient > >> Last Treatments ) and also ( Info about his disease )... and I did it > >> with the SELECTEDINDEX of the ComboBox but it's only displaying one > >> date........... > > >> Please can you guys help me to display all the visited dates of the > >> Selected Patients ID....... I 'ld be very great full.... thank you > >> even if yu tried so.... > > >> H- Hide quoted text - > > - Show quoted text -
