perl|访问|数据|数据库不只是vb.net,C#等微软的开发软件可以调用.net framework,据我所知至少有28中我知道的开发语言如何调用.net framework.下面我就给出一段事例,说明使用perl.net来访问数据库
<% Page Language="Perl" %>
<script runat="server">
use namespace "System::Data";
use namespace "System::Data::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>
<html>
<body>
<form runat="server">
<asp:DataGrid id="myDataGrid" runat="server" />
</form>
</body>
</html>
使用perl.net访问数据库
80酷酷网 80kuku.com