Asp.net/perl.net Database Access Example

Source: Internet
Author: User
Asp.net/perl.net Database Access Example
One of the features of the. NET Framework is it ability to handle multiple languages. Third party compiler vendors can create and implement a compiler targeted for the. NET Runtime. In fact, over the course of the "next year", you can expect to the some languages to the. NET ported. This would allow companies with the huge codebase in a "Non-microsoft language" to continue building onto their.
Note:all of the software required to create and run asp.net pages built using Perl.net can is downloaded here.
This is the code for the whole page (we'll dissect and explain each bit of the code throughout the rest of the article):
<%@ Page
Language= "Perl"%>
<script runat= "Server" >
Use namespace "System::D ata";
Use namespace "System::D ata::sqlclient";
=for interface
protected override void OnLoad (System.EventArgs e);
=cut
Sub OnLoad {
My ($this, $e) = @_;
My $myConnection = Sqlconnection->new ("Data source=" (local); Trusted_connection=yes; Initial
Catalog=pubs ");
My $myCommand = sqlcommand->new ("Select * from Publishers", $myConnection);
$myConnection->open ();
$this->{mydatagrid}{datasource} = $myCommand->executereader (perlnet::enum
("CommandBehavior.CloseConnection"));
$this->{mydatagrid}->databind;
}
</script>
<body>
<form runat= "Server" >
<asp:datagrid id= "Mydatagrid" runat= "Server"/>
</form>
</body>
Related Article

Contact Us

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

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.