3
Reply

null values

aylin_sk

aylin_sk

Dec 10 2004 2:11 AM
3.3k
Hi, I can insert the records to database but p_patient_recordstatus is a checkbox and p_patient_period is a textbox..I want them to be inserted as null value...but Oracle doesnt accept null values while im inserting....so I get an error about null values.....How can i insert them as null values?? 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_period", OracleType.VarChar, 1).Value = "patientPeriod"; if (patientWeek.Equals("")) myCommand.Parameters.Add("p_patient_week", OracleType.Number).Value = DBNull.Value; else myCommand.Parameters.Add("p_patient_week", OracleType.Number).Value = Int32.Parse(patientWeek); myCommand.Parameters.Add("p_patient_potential", OracleType.VarChar, 1).Value = patientPotential; myCommand.Parameters.Add("p_patient_record_status", OracleType.VarChar, 1).Value = "patientRecordStatus";

Answers (3)