Access | data | database <@ Page language= "COBOL" >
<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.
Mysqlconnection OBJECT REFERENCE SqlConnection.
Mysqlcommand OBJECT REFERENCE SqlCommand.
Mysqldatareader OBJECT REFERENCE SqlDataReader.
MyType OBJECT REFERENCE Sys-type.
DataSource OBJECT REFERENCE ICollection.
Linkage section.
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>
<body>
<form runat= "Server" >
<asp:datagrid id= "Mydatagrid" runat= "Server"/>
</form>
</body>
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.
A Free Trial That Lets You Build Big!
Start building with 50+ products and up to 12 months usage for Elastic Compute Service