如何在ope中使用此代码从oracle连接我的数据库

时间:2012-11-16 18:22:05

标签: javascript html css3 oracle-apex

我正在使用apex 4.0,并使用预制报告,HTML,jQuery JavaScript和CSS在区域内构建报告,我想从Oracle数据库中检索数据。

如何从Oracle数据库中检索此代码中的数据?

 <a class="offline-button" href="../index.html">Back</a>
 <script src="#WORKSPACE_IMAGES#people.js" type="text/javascript"></script>

    <div id="example" class="k-content">
        <div id="clientsDb">

            <div id="grid" style="height: 380px"></div>

        </div>

        <style scoped>
            #clientsDb {
                width: 692px;
                height: 413px;
                margin: 30px auto;
                padding: 51px 4px 0 4px;
                background: url(#WORKSPACE_IMAGES#clientsDb.png) no-repeat 0 0;
            }
        </style>
        <script>
            $(document).ready(function() {
                $("#grid").kendoGrid({
                    dataSource: {
                        data: createRandomData(50),
                        pageSize: 10
                    },
                    groupable: true,
                    sortable: true,
                    pageable: {
                        refresh: true,
                        pageSizes: true
                    },
                    columns: [ {
                            field: "FirstName",
                            width: 90,
                            title: "First Name"
                        } , {
                            field: "LastName",
                            width: 90,
                            title: "Last Name"
                        } , {
                            width: 100,
                            field: "City"
                        } , {
                            field: "Title"
                        } , {
                            field: "BirthDate",
                            title: "Birth Date",
                            template: '#= kendo.toString(BirthDate,"dd MMMM yyyy") #'
                        } , {
                            width: 50,
                            field: "Age"
                        }
                    ]
                });
            });
        </script>
    </div>

1 个答案:

答案 0 :(得分:0)

您可以通过不同的方式执行此操作但由于帖子中的信息较少,我将主要尝试回答您的问题,即“如何从Oracle数据库中检索数据”

<script language="JavaScript1.1" type="text/javascript">

function getYourDataTableList (narrowText, empSelect) //getYourDataTableList should be the table you would like to retrive

{  

  var empSelectObj = document.getElementFirstName(FirstName);

  var ajaxRequest = new htmldb_Get(null,&APP_ID.,'APPLICATION_PROCESS=getYourDataTableList ,0);

  ajaxRequest.add('P1_FirstName_NARROW',narrowText.value);

  ajaxResult = ajaxRequest.get();

  if(ajaxResult)

    {   

      empSelectObj.options.length = 0;

      var empArray = ajaxResult.split("~empsep~");

       for(var i=0; i < empArray.length; i++) {

        var colArray = empArray[i].split("~colsep~");

        empSelectObj.options[i] = new Option(colArray[1], colArray[0]);

      }

    }

    else

    {

      empSelectObj.options.length = 0;

    }

  ajaxRequest = null;   

}  

 </script> 

- 代码不是测试人员,也不是功能齐全的我建议你按照这个例子进行操作 http://www.dba-oracle.com/t_html_db_apex_ajax_application_express.htm


另外考虑如果你使用的是iFrame,你可能会遇到这个问题:(如果iframe src与visualforce页面不同,浏览器将不允许javascript访问内容,因为被认为是跨站点脚本攻击。)
来源http://boards.developerforce.com/t5/Apex-Code-Development/How-we-get-the-iframe-data-in-apex-page-using-javascript/td-p/446781