可真是奇怪呀.
请各位帮看看.
<%@ import namespace="System.Data.OleDb" %>
<%@ import namespace="system.data" %>
<%@ Page Language="vb" AutoEventWireup="true" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<title>WebForm7</title>
<script language=vb runat=server >
Dim conn As New OleDbConnection("provider=microsoft.jet.oledb.4.0;data source=C:\\Program Files\\Microsoft Office\\OFFICE\\SAMPLES\\Northwind.mdb")
Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
If (Not IsPostBack) Then
DataGridBind()
End If
End Sub
Sub DataGridBind()
Dim strSql As String
strSql = "select * from 产品"
Dim ds As New DataSet
conn.Open()
Dim myAdapter As New OleDbDataAdapter(strSql, conn)
myAdapter.Fill(ds, "ds")
DataGrid1.DataSource = ds.Tables(0).DefaultView
DataGrid1.DataBind()
conn.Close()
End Sub
</script>
</HEAD>
<body MS_POSITIONING="GridLayout">
<form id="Form1" method="post" runat="server">
<asp:DataGrid id="DataGrid1" runat="server" Width="632px" Height="128px" AllowPaging="True">
<PagerStyle Mode="NumericPages" BackColor="#FFC0C0" ></PagerStyle>
</asp:DataGrid>
</form>
</body>
</HTML>
[此贴子已经被作者于2006-10-1 15:11:34编辑过]