欢迎光临
我们一直在努力

使用COBOL.net访问数据库-.NET教程,.NET Framework

建站超值云服务器,限时71元/月

<@ page language="cobol">
<html>
<head>
    <script runat="server" language="cobol">
       environment division.
       configuration section.
       repository.
       property datasource
       property mydatagrid
       class sqlconnection as "system.data.sqlclient.sqlconnection"
       class sqlcommand as "system.data.sqlclient.sqlcommand"
       class sqldatareader as "system.data.sqlclient.sqldatareader"    
       class sys-eventargs as "system.eventargs"
       class sys-type as "system.type".
       object.
       procedure division.
       method-id. onload as "onload" override.
       data division.
       working-storage section.
       01 mysqlconnection object reference sqlconnection.
       01 mysqlcommand object reference sqlcommand.
       01 mysqldatareader object reference sqldatareader.
       01 mytype object reference sys-type.
       01 datasource object reference icollection.
       linkage section.
       01 args object reference sys-eventargs.
        procedure division using by value args.
       invoke super "onload" using by value args.
       invoke sqlconnection "new" using by value "data source=(local); trusted_connection=yes;
                                                  initial catalog=pubs" returning mysqlconnection.
       invoke sqlcommand "new" using by value "select * from publishers" mysqlconnection
                                                                      returning mysqlcommand.
       invoke mysqlconnection "open".
       invoke mysqlcommand "executereader" returning mysqldatareader.
       set datasource of mydatagrid to mysqldatareader.
       invoke mydatagrid "databind".
          invoke mysqlconnection "close".
       end method onload.
       end object.
    </script>
</head>
<body>
<form runat="server">
<asp:datagrid id="mydatagrid" runat="server" />
</form>
</body>
</html>

赞(0)
版权申明:本站文章部分自网络,如有侵权,请联系:west999com@outlook.com 特别注意:本站所有转载文章言论不代表本站观点! 本站所提供的图片等素材,版权归原作者所有,如需使用,请与原作者联系。未经允许不得转载:IDC资讯中心 » 使用COBOL.net访问数据库-.NET教程,.NET Framework
分享到: 更多 (0)