Передача параметра в oraclecommand в C#
у меня с этим проблемы.
пожалуйста, загляните в этот код и помогите.
спасибо
Что я уже пробовал:
try { string query = "SELECT uetc.team_codes, LPAD (papf.employee_number, 5, 0) staff_id,papf.full_name full_name, papf.email_address,LPAD (papf1.employee_number, 5, 0) supervisor_id,papf1.full_name supervisor_name, papf1.email_address, hl.location_code, SUBSTR (hl.location_code, 1, 3) branch_code, SUBSTR (hl.location_code, 6) branch_name, hl.loc_information15 region_name, hl.loc_information14 zone_name FROM per_all_people_f papf, per_all_assignments_f paaf, per_grades pg, per_jobs pj, hr_locations_all hl, hr_all_organization_units haou, per_all_people_f papf1, per_all_assignments_f paaf1, per_grades pg1, per_jobs pj1, hr_locations_all hl1, hr_all_organization_units haou1, ub_emp_team_codes_new uetc WHERE papf.person_id = paaf.person_id AND papf.current_employee_flag = 'Y' AND SYSDATE BETWEEN papf.effective_start_date AND papf.effective_end_date AND paaf.primary_flag = 'Y' AND papf.employee_number < 7000 AND papf.employee_number <> 00000 AND SYSDATE BETWEEN paaf.effective_start_date AND paaf.effective_end_date AND paaf.grade_id = pg.grade_id(+) AND paaf.job_id = pj.job_id(+) AND paaf.location_id = hl.location_id(+) AND paaf.organization_id = haou.organization_id(+) AND paaf.supervisor_id = papf1.person_id(+) AND papf1.person_id = paaf1.person_id(+) AND papf1.current_employee_flag(+) = 'Y' AND SYSDATE BETWEEN papf1.effective_start_date(+) AND papf1.effective_end_date(+) AND paaf1.primary_flag(+) = 'Y' AND SYSDATE BETWEEN paaf1.effective_start_date(+) AND paaf1.effective_end_date(+) AND paaf1.grade_id = pg1.grade_id(+) AND paaf1.job_id = pj1.job_id(+) AND paaf1.location_id = hl1.location_id(+) AND paaf1.organization_id = haou1.organization_id(+) AND papf.person_id = uetc.person_id(+) AND uetc.person_id(+) = papf.person_id AND papf.employee_number = @staff_id"; OracleCommand OraC = new OracleCommand(query, OracleConn); OraC.CommandType = CommandType.Text; OraC.Parameters.Add(new OracleParameter("@staff_id", OracleDbType.Varchar2)).Value = staffid; //OraC.Parameters.Add(new OracleParameter("SESSION_ID", OracleDbType.Varchar2)).Value = SessionID; //OraC.Parameters.Add(new OracleParameter("V_RESULT", OracleDbType.Varchar2, 32767)).Direction = ParameterDirection.Output; //OracleDataReader dr = OraC.ExecuteNonQuery(); OracleDataReader dr = OraC.ExecuteReader(); while (dr.Read()) { SupervisorEmail = dr["EMAIL_ADDRESS_1"].ToString(); StaffEmail = dr["EMAIL_ADDRESS"].ToString(); string id = dr["STAFF_ID"].ToString(); } } catch (Exception ex) { ex.Message.ToString(); } finally { OracleConn.Close(); }
Richard Deeming
Мы должны угадать, какие "проблемы" у вас возникли?
Нажмите кнопку "улучшить вопрос" и обновите свой вопрос с правильным описанием проблемы. Включите полную информацию о любых ошибках - возможно, вы захотите начать с удаления catch
блок, который в настоящее время молча проглатывает все исключения.