• ado.net读取oracle结果集


     1 /**
     2  3  4  5   */

    ---oracle中使用游标返回数据,在ado.net中进行读取 6 PROCEDURE ISDT_VEHICLE_TASK_CHECK(P_CARNUM IN VARCHAR2, 7 CUR_OUT OUT sys_refcursor 8 ) IS 9 G_HAS_TASK varchar2(40); -- 任务编号 10 BEGIN 11 12 select max(t.task_id) 13 into G_HAS_TASK 14 from T_ISDT_VEHICLE_TASK_LAST t 15 where t.car_num = P_CARNUM 16 and rownum = 1 17 order by t.created_date desc; 18 19 if G_HAS_TASK is not null then 20 21 22 OPEN CUR_OUT FOR 23 select t.task_id, 24 ds.id, 25 ds.site_code, 26 ds.center_lon, 27 ds.center_lat, 28 ds.latlons, 29 ds.center_lon_bd, 30 ds.center_lat_bd, 31 ds.latlons_bd 32 from T_ISDT_VEHICLE_TASK_LAST t 33 inner join t_isdt_delivery_site ds 34 on t.sender_site_id = ds.id 35 and ds.state = 1 36 where t.car_num = P_CARNUM 37 and rownum = 1 38 order by t.created_date desc; 39 40 /*OPEN CUR_CARTASK FOR 41 select vi.id as vehicleID,st.task_id as taskID from T_ISDT_VEHICLE_TASK_LAST st 42 inner join t_isdt_vehicle_info vi on vi.car_num=st.car_num 43 where st.car_num = P_CARNUM and rownum = 1 44 order by st.created_date desc; 45 */ 46 --存在任务 47 ----P_STATE := 1; 48 else 49 50 OPEN CUR_OUT FOR 51 select '' as task_id, 52 '' as id, 53 '' as site_code, 54 '' as center_lon, 55 '' as center_lat, 56 '' as latlons, 57 '' as center_lon_bd, 58 '' as center_lat_bd, 59 '' as latlons_bd 60 from dual; 61 62 /*OPEN CUR_CARTASK FOR 63 select '' as vehicleID,'' as taskID from dual;*/ 64 65 --不存在任务 66 ----P_STATE := 0; 67 end if; 68 END ISDT_VEHICLE_TASK_CHECK;

    ado.net读取oracle雷彪

     /// <summary>
     
            /// wyg 2017-3-10 
            /// </summary>
            /// <param name="vehicleNo"></param>
            /// <returns></returns>
            public List<AreaSite> CheckVehicleInTask(string vehicleNo, out string vehicleId, out string taskId)
            {
                vehicleId = taskId = string.Empty;
                var list = new List<AreaSite>();
                Database database = DBHelper.CreateDataBase();
                DbCommand command = database.GetStoredProcCommand("ISDT_VEHICLE_DATA_SYNC.ISDT_VEHICLE_TASK_CHECK");
                database.AddInParameter(command, "P_CARNUM", DbType.String, vehicleNo);
    
             
                using (IDataReader reader = database.ExecuteReader(command))
                {
                    while (reader.Read())
                    {
                        list.Add(new AreaSite(reader));
                    }
                    if (reader.NextResult())
                    {
                        if (!reader.IsDBNull(0))
                        {
                            vehicleId = reader.GetString(0);
                        }
                        if (!reader.IsDBNull(1))
                        {
                            taskId = reader.GetString(1);
                        }
                    }
                }
                return list;
            }
    

     ORACLE中返回多个游标信息:http://www.360doc.com/content/10/0511/23/1121193_27150614.shtml

    搏击长空
  • 相关阅读:
    金蝶问题:不能保存已审核的单据
    在代码中设置cxTreeList按多列排序
    日积月累篇:生产任务单
    sp_reset_connection
    日积月累篇:仓库流程
    使用FreeMarker生成Word文档 仅此而已
    ASP格式化时间日期(二)
    省市区三级联动连接数据库
    利用SQL语句进行添加、删除、修改字段,表与字段的基本操作,数据库备份等
    ASP截取字数(二)
  • 原文地址:https://www.cnblogs.com/yitong/p/6535012.html
Copyright © 2020-2023  润新知