Ejemplo n.º 1
0
        public void TestSQLProc(String callback)
        {
            //Create objects

            ConnectionHandler LoginObj = GetConnection();
            OracleCommand     cmd      = LoginObj.GetCommand();
            OracleDataAdapter da       = new OracleDataAdapter();
            OracleDataHandler dh       = new OracleDataHandler();

            cmd.CommandText = "somepackage.get_function";
            cmd.CommandType = CommandType.StoredProcedure;
            cmd.Parameters.Add("V_KEY", OracleDbType.Int32).Value            = 123456;
            cmd.Parameters.Add("T_CURSOR", OracleDbType.RefCursor).Direction = ParameterDirection.Output;
            cmd.ExecuteNonQuery();

            da.SelectCommand = cmd;
            DataTable dt = new DataTable();

            da.Fill(dt);

            Response NewResponse = new Response();

            NewResponse.Success   = true;
            NewResponse.ResultSet = dh.Serialize(dt);
            NewResponse.Message   = "Test Function";

            //Return results as a Json.
            Context.Response.Clear();
            Context.Response.ContentType = "application/json";
            Context.Response.Write(JsonConvert.SerializeObject(NewResponse, Formatting.Indented));
            Context.Response.End();
        }
Ejemplo n.º 2
0
        public void TestSQL(String callback)
        {
            ConnectionHandler LoginObj = GetConnection();
            OracleCommand     cmd      = LoginObj.GetCommand();

            cmd.CommandText = "select 'test' h from dual union select 'test2' h from dual";
            cmd.CommandType = CommandType.Text;
            OracleDataReader  dr = cmd.ExecuteReader();
            OracleDataHandler dh = new OracleDataHandler();

            Response NewResponse = new Response();

            NewResponse.Success   = true;
            NewResponse.ResultSet = dh.Serialize(dr);
            NewResponse.Message   = "Test";

            //Return results as JSON.
            Context.Response.Clear();
            Context.Response.ContentType = "application/json";
            Context.Response.Write(JsonConvert.SerializeObject(NewResponse, Formatting.Indented));
            Context.Response.End();
        }