Overloading method

Please support our C# advertiser: Intel Parallel Studio Home
Reply

Join Date: Jul 2008
Posts: 30
Reputation: Hannahlv is an unknown quantity at this point 
Solved Threads: 0
Hannahlv Hannahlv is offline Offline
Light Poster

Overloading method

 
0
  #1
Aug 4th, 2008
Hello all,
I have overloading method problem with my miniproject. The code is below :
  1. patients.UpdatePatientsDetail(patientsidTextBox.Text, patientsnameLabel1.Text);

Error is : no overload for UpdatePatientsDetail takes '2' arguments
Code for this method is :
  1. public void UpdatePatientsDetail(string strPatientsID, string strPatientsName, string strPatientsAddress, string strPatientsTelephonenumber, string strPatientsDateofBirth, string strPatientsNric, string strPatientsEmailAdress, string strPatientsApponitmentTime)
  2. {
  3. string SQL;
  4. SQL = "UPDATE Patients SET PatientsName = '" + strPatientsName +
  5. "', PatientsAddress = '" + strPatientsAddress +
  6. "', PatientsTelephonenumber = '" + strPatientsTelephonenumber +
  7. "', PatientsDateofBirth = '" + strPatientsDateofBirth +
  8. "', PatientsNric = '" + strPatientsNric +
  9. "', PatientsEmailAdress = '" + strPatientsEmailAdress +
  10. "', PatientsAppointmentTime = '" + strPatientsApponitmentTime +
  11. "' where PatientsID = " + strPatientsID + "";
  12. ExecuteDataCommand(SQL);
  13. }

I can't fix the error. Any help will be appreciated. Thank you.
Reply With Quote Quick reply to this message  
Join Date: Jul 2007
Posts: 20
Reputation: tostrinj is an unknown quantity at this point 
Solved Threads: 1
tostrinj's Avatar
tostrinj tostrinj is offline Offline
Newbie Poster

Re: Overloading method

 
0
  #2
Aug 4th, 2008
Your method takes 8 parameters, and you are trying to call it with just two params. Either give it all 8 or override the UpdatePatientDetails() to take 2 parameters
===========================
can you repeat the part of the stuff where you said all about the things?
Reply With Quote Quick reply to this message  
Join Date: Jul 2008
Posts: 30
Reputation: Hannahlv is an unknown quantity at this point 
Solved Threads: 0
Hannahlv Hannahlv is offline Offline
Light Poster

Re: Overloading method

 
0
  #3
Aug 5th, 2008
Thank you for your reply.
I still got error can't overload the method.
  1. consu.UpdateConsultationDetail(consultationidTextBox.Text, consultationdateTextBox.Text, patientspastillnessComboBox.Items.Add, patientspastdiagnosisComboBox.Items.Add, patientscurrentillnessTextBox.Text, patientscurrentdiagnosisComboBox.Items.Add);

The method is below :
  1.  
  2. public void UpdateConsultationDetail(string strConsultationID, string strDiagnosis, string strConsultationDate, string strPatientsPastIllness, string strPatientsCurrentIllness, string strPatientsPastDiagnosis, string strPatientsCurrentDiagnosis)
  3. {
  4. string SQL;
  5. SQL = "UPDATE Consultation SET ConsultationDate = '" + strConsultationDate +
  6. "', PatientsPastIllness = '" + strPatientsPastIllness +
  7. "', PatientsPastDiagnosis = '" + strPatientsPastDiagnosis +
  8. "', PatientsCurrentDiagnosis = '" + strPatientsCurrentDiagnosis +
  9. "', PatientsCurrentIllness = '" + strPatientsCurrentIllness +
  10. "' where ConsultationID = " + strConsultationID + "";
  11. ExecuteDataCommand(SQL);
  12. }

How to fix it? I passed enough parameters but still got error. Thanks.
Last edited by Hannahlv; Aug 5th, 2008 at 12:44 am.
Reply With Quote Quick reply to this message  
Join Date: Aug 2008
Posts: 2
Reputation: airyym is an unknown quantity at this point 
Solved Threads: 0
airyym airyym is offline Offline
Newbie Poster

Re: Overloading method

 
0
  #4
Aug 5th, 2008
I think you passed the wrong parameters.

patientspastillnessComboBox.Items.Add
patientspastdiagnosisComboBox.Items.Add,
patientscurrentdiagnosisComboBox.Items.Add
is it the String above three parameters?

As I knew, those means that the event.
Reply With Quote Quick reply to this message  
Join Date: Jul 2008
Posts: 1
Reputation: jmneter is an unknown quantity at this point 
Solved Threads: 0
jmneter jmneter is offline Offline
Newbie Poster

Re: Overloading method

 
0
  #5
Aug 5th, 2008
Cool!
IVR
Reply With Quote Quick reply to this message  
Join Date: Jul 2008
Posts: 30
Reputation: Hannahlv is an unknown quantity at this point 
Solved Threads: 0
Hannahlv Hannahlv is offline Offline
Light Poster

Re: Overloading method

 
0
  #6
Aug 5th, 2008
The parameters declare are strings, but those are all combobox and I want to pass all the content of combobox into the method. So now what should I do?
Reply With Quote Quick reply to this message  
Join Date: Aug 2008
Posts: 2
Reputation: airyym is an unknown quantity at this point 
Solved Threads: 0
airyym airyym is offline Offline
Newbie Poster

Re: Overloading method

 
0
  #7
Aug 5th, 2008
That's easy way here.

Your method :

consu.UpdateConsultationDetail(consultationidTextBox.Text, consultationdateTextBox.Text, patientspastillnessComboBox.Items.Add, patientspastdiagnosisComboBox.Items.Add, patientscurrentillnessTextBox.Text, patientscurrentdiagnosisComboBox.Items.Add);
changed into:

consu.UpdateConsultationDetail(consultationidTextBox.Text, consultationdateTextBox.Text, patientspastillnessComboBox, patientspastdiagnosisComboBox, patientscurrentillnessTextBox.Text, patientscurrentdiagnosisComboBox);

after doing this,

you can choose items in CheckBox in the method by

(String)patientspastillnessComboBox.Items[INDEX_NUM]; // INDEX_NUM: 0 ~ n(existed item number)

I hope this reply help you.
Reply With Quote Quick reply to this message  
Join Date: Jul 2008
Posts: 30
Reputation: Hannahlv is an unknown quantity at this point 
Solved Threads: 0
Hannahlv Hannahlv is offline Offline
Light Poster

Re: Overloading method

 
0
  #8
Aug 5th, 2008
Thanks for the reply now the problem is that i dont know where to add this code String)patientspastillnessComboBox.Items[INDEX_NUM]; // INDEX_NUM: 0 ~ n(existed item number)
Reply With Quote Quick reply to this message  
Join Date: Jun 2006
Posts: 37
Reputation: ramiljoaquin is an unknown quantity at this point 
Solved Threads: 2
ramiljoaquin ramiljoaquin is offline Offline
Light Poster

Re: Overloading method

 
0
  #9
Aug 5th, 2008
Originally Posted by Hannahlv View Post
Thanks for the reply now the problem is that i dont know where to add this code String)patientspastillnessComboBox.Items[INDEX_NUM]; // INDEX_NUM: 0 ~ n(existed item number)

Change the code of all combobox.

from:
patientspastdiagnosisComboBox.Items.Add

to:
patientspastdiagnosisComboBox.SelectedItem.ToString()
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC