public void GetData (string username, string Userip, String UserKey, String Userareaid, String ypid, String In_prov Inces, String Yearid, out DataTable data, out string out_success, out string out_message) {try {String constr = configurationmanager.connectionstrings["Constr"]. ToString (); using (oracleconnection con = new OracleConnection (constr)) {con. Open (); OracleCommand cmd = new OracleCommand ("Proc_pricefind", con); Cmd.commandtype = CommandType.StoredProcedure; Oracleparameter[] paras = new oracleparameter[] {new OracleParameter ("username", user Name), New OracleParameter ("Userip", Userip), New OracleParameter ("UserKey", UserKey ), New OracleParameter ("Userareaid", Userareaid), New OracleParameter ("Ypids", Ypid) , New OracleParameter ("In_provinces", in_provinces), New OracleParameter ("Yearid", year ID), New OracleParameter ("Data", OracleType.Cursor), New OracleParameter ("Out_success", Oracle type.varchar,4000), New OracleParameter ("Out_message", oracletype.varchar,4000)}; Paras[paras. LENGTH-1]. Direction = ParameterDirection.Output; Paras[paras. Length-2]. Direction = ParameterDirection.Output; Paras[paras. Length-3]. Direction = ParameterDirection.Output; Cmd. Parameters.addrange (paras. ToArray ()); OracleDataAdapter da = new OracleDataAdapter (cmd); DataSet ds = new DataSet (); Da. Fill (DS); Out_success = Paras[paras. Length-2]. Value.tostring (); Out_message = Paras[paras. LENGTH-1]. Value.tostring (); data = ds. Tables[0]; If no data set is returned, you can use ExecuteNonQuery () directly. Then take out the value so that you do not need to replace the OracleDataReader with a DataTable//cmd. ExecuteNonQuery (); Out_message = Paras[paras. Length-3]. Value; OracleDataReader ODR = Paras[paras. Length-3]. Value as OracleDataReader; Data=convertdatareadertodatatable (ODR); }} catch (Exception ex) {out_success = "0"; Out_message = ex. Message; data = null; } }
Create or Replace procedure Proc_pricefind (username varchar, userip VA Rchar, UserKey varchar, USERAREAI d varchar, ypids varchar, in _provinces varchar, Yearid varchar, Data out sys_refcursor, out_success out varchar, Out_message out varchar) is findcount number; Configcount number; Findareaidcount number; Configareacount number; GUID varchar (out_success); begin: = ' 0 '; Out_message: = "; Select Sys_guid () into GUIDs from dual; Insert into Findprice_userrecord (RecordID, Usernmae, Userip, UserKey, Userareaid, Ypid, finDareaid, Yearid, Addtime) VALUES (GUID, username, Userip, UserKey, Userareaid, Ypids, In_provinces, Yearid, sysdate); Commit INSERT into Findprice_log_userrecord Select GUID, Sys_guid (), B. Product name, B. Name of the dosage form, B. specifications, B. Conversion coefficients, B. Material, B. Enterprise name, T.purprice from Mid_monthspurprice t inner Jo In View_drug A to A.sdid = T.sdid INNER join Base_stddrug b on a.sdcode = B. Original code where SUBSTR (T.DR, 0, 4) = Yearid and b.ypid = ypids and t.provinceareaid = in_provinces; Commit --Judging the number of calculation bars select count (distinct t.ypid | | ', ' | | t.findareaid| | ', ' | | t.yearid) KK into Findcount from Findprice_userre Cord t where t.userareaid = Userareaid; Select T.findnumber to Configcount from Findprice_config t where t.areaid = Userareaid; If Findcount > Configcount then delete from Findprice_userrecord t where T.recordid = GUID; DeleTe from Findprice_log_userrecord t where T.recordid = GUID; Commit --delete the inserted data raise_application_error (-20000, ' the total number of queries exceeds the limit '); End If; --Determine the province of the calculation select COUNT (1) Tol into out_success from Mon_joinpoint where InStr ((select min (t.findareaid) From Findprice_config t where T.areaid = Userareaid), provinceidnew) > 0 and PR Ovinceareaid in (in_provinces); Select COUNT (Distinct t.findareaid) tol into Findareaidcount from Findprice_userrecord t where T.userareaid = user Areaid; If out_success = 0 and findareaidcount > Ten then delete from Findprice_userrecord t where T.recordid = GUID; Delete from Findprice_log_userrecord t where T.recordid = GUID; Commit Raise_application_error (-20000, ' query province exceeded limits ' | | configcount); End If; Open data for select Ypids, b. Product name, B. Type name, b. Specification, B. Conversion factor, B. Material, B. Enterprise name, T.purprice from MID_MONTHSPUrprice T INNER join view_drug A on a.sdid = T.sdid INNER join Base_stddrug b on a.sdcode = B. Original code where substr (t.dr, 0, 4) = Yearid and b.ypid = ypids and t.provinceareaid = in_provinces; out_success:= ' 1 '; end Proc_pricefind;
. NET uses Oracle's stored procedures have return values also have datasets