aylin_sk

aylin_sk

  • NA
  • 87
  • 0

pls help to my error

Dec 6 2004 7:11 AM
I wrote this code in different sheets..One is written to .aspx.cs file and the other one is written to .cs file. But when I execute my project, I got error like: Input string was not in a correct format. Line 87: myPatient.addPatient(textPatientName.Text, textPatientLastName.Text, comboPatientSex.SelectedItem.Value, textPatientTreatStartDate.Text, public bool addPatient (string patientName, string patientLastName, string patientSex, string patientTreatStartDate,string patientBirthDate, string patientParent, string patientPhone, string patientAddress1,string patientAddress2, string patientCountyId, string patientCityId, string patientZipCode,string patientGroup, string patientExplanation, string patientWeek, string patientPotential) { OracleConnection myConnection = new OracleConnection(myRegistry.getRegistryValue("connectionString")); OracleCommand myCommand = myConnection.CreateCommand(); myCommand.CommandText = "LPMS.PATIENTS_PKG.ADD_PATIENT"; myCommand.CommandType = CommandType.StoredProcedure; myCommand.Parameters.Add("p_patient_name", OracleType.VarChar, 20).Value = patientName; myCommand.Parameters.Add("p_patient_last_name", OracleType.VarChar, 20).Value = patientLastName; myCommand.Parameters.Add("p_patient_sex", OracleType.VarChar, 1).Value = patientSex; myCommand.Parameters.Add("p_patient_treat_start_date", OracleType.VarChar, 10).Value = patientTreatStartDate; myCommand.Parameters.Add("p_patient_birthdate", OracleType.VarChar, 10).Value = patientBirthDate; myCommand.Parameters.Add("p_patient_parent", OracleType.VarChar, 50).Value = patientParent; myCommand.Parameters.Add("p_patient_phone", OracleType.VarChar, 40).Value = patientPhone; myCommand.Parameters.Add("p_patient_address1", OracleType.VarChar, 50).Value = patientAddress1; myCommand.Parameters.Add("p_patient_address2", OracleType.VarChar, 50).Value = patientAddress2; if (patientCountyId.Equals("")) myCommand.Parameters.Add("p_patient_county_id", OracleType.Number).Value = DBNull.Value; else myCommand.Parameters.Add("p_patient_county_id", OracleType.Number).Value = Int32.Parse(patientCountyId); if (patientCityId.Equals("")) myCommand.Parameters.Add("p_patient_city_id", OracleType.Number).Value = DBNull.Value; else myCommand.Parameters.Add("p_patient_city_id", OracleType.Number).Value = Int32.Parse(patientCityId); myCommand.Parameters.Add("p_patient_zipcode", OracleType.VarChar, 5).Value = patientZipCode; myCommand.Parameters.Add("p_patient_group", OracleType.VarChar, 1).Value = patientGroup; myCommand.Parameters.Add("p_patient_explanation", OracleType.VarChar, 75).Value = patientExplanation; myCommand.Parameters.Add("p_patient_week", OracleType.Number, 1).Value = patientWeek; myCommand.Parameters.Add("p_patient_potential", OracleType.VarChar, 1).Value = patientPotential; OracleDataAdapter adapter = new OracleDataAdapter(myCommand); try { myConnection.Open(); myCommand.ExecuteNonQuery(); myConnection.Close(); } catch (OracleException e) { string errorMessages = ""; errorMessages += "Message: " + e.Message + "\n" + "Source: " + e.Source + "\n"; System.Diagnostics.EventLog log = new System.Diagnostics.EventLog(); log.Source = "discoveryZone"; log.WriteEntry(errorMessages, System.Diagnostics.EventLogEntryType.Error, e.Code); myError.lastError = errorMessages; return(false); } return(true); } -------------------------------- private void Button1_Click(object sender, System.EventArgs e) { coreLpms.patients myPatient = new coreLpms.patients(); string patientPotential = "H"; if (cbPatientPotential.Checked) patientPotential = "E"; else patientPotential = "H"; myPatient.addPatient(textPatientName.Text, textPatientLastName.Text, comboPatientSex.SelectedItem.Value, textPatientTreatStartDate.Text, textPatientBirthdate.Text, textPatientParent.Text, textPatientPhone.Text, textPatientAddress1.Text, textPatientAddress2.Text, textPatientCountyId.Text, textPatientCityId.Text, textPatientZipCode.Text, comboPatientGroup.SelectedItem.Value, textPatientExplanation.Text, textPatientWeek.Text, patientPotential); } }

Answers (3)