我写了index.aspx与index.aspx.vb程序,在index.aspx中使用src=index.aspx.vb可以正常显示数据库中的数据,现我想通过vbc命令把index.aspx.vb编译成.dll文件,可是就是不成功.我的系统是winxp,只装了sdk1.1,我在dos命令下进入D:\WINDOWS\Microsoft.NET\Framework\v1.1.4322,后打入vbc /t:library index.aspx.vb,提示了很多的错误,如:"namespace or type 'data' for the Imports 'system.data' cannot be fond"等.请问.vb程序要怎样改,才符合要求呀?谢谢各位,这是我第一次做编译,请大家指教.
index.aspx
-------------------
<%@ Page language="vb" Src="index.aspx.vb" Inherits="nhonline.dg" %>
<form runat="server">
<asp:DataGrid id="MyDataGrid"
AllowPaging="True"
PageSize="2"
OnPageIndexChanged="MyDataGrid_Page"
runat="server"
AutoGenerateColumns="False"
Width="200">
<HeaderStyle BackColor="Navy"
ForeColor="White"
Font-Bold="True"
HorizontalAlign="Center"/>
<PagerStyle Mode="NextPrev"
HorizontalAlign="Right"
NextPageText="ÏÂÒ»Ò³"
PrevPageText="ÉÏÒ»Ò³"/>
<Columns>
<asp:BoundColumn DataField="id" HeaderText="ID"/>
<asp:TemplateColumn HeaderText="ÐÕÃû">
<ItemTemplate>
<asp:Label ID="lblname" Text='<%#(Container.DataItem("name"))%>' Runat="server"/>
</ItemTemplate>
</asp:TemplateColumn>
</Columns>
</asp:DataGrid>
</form>
index.aspx.vb
--------------------
Imports System
Imports System.Data
Imports System.Data.OleDb
Imports System.Web.UI.WebControls
Namespace nhonline
Public Class dg : Inherits System.Web.UI.Page Protected MyConnection As System.Data.OleDb.OleDbConnection
Protected MyCommand As System.Data.OleDb.OleDbDataAdapter
Protected DS As System.Data.DataSet
Protected MyDataGrid As System.Web.UI.WebControls.Datagrid
Protected lblName As System.Web.UI.WebControls.Label Sub Page_Load(sender As System.Object, e As System.EventArgs)
MyConnection = New OleDbConnection( "Provider=Microsoft.Jet.OLEDB.4.0; Data Source =" + Server.MapPath(".")+"/db/data.mdb") If Not Page.IsPostBack Then
BindGrid()
End If
End Sub Sub MyDataGrid_Page(sender as Object, e As DataGridPageChangedEventArgs)
MyDataGrid.CurrentPageIndex = e.NewPageIndex
BindGrid()
End Sub Sub BindGrid()
Dim MyCommand as OleDbDataAdapter = new OleDbDataAdapter("select * from info", MyConnection)
Dim DS as DataSet = new DataSet()
MyCommand.Fill(DS,"info")
MyDataGrid.DataSource = DS.Tables("info").DefaultView
MyDataGrid.DataBind()
End SubEnd Class
End Namespace