我的配置情况跟你差不多,我发个例子给你吧authors.aspx 内容如下:
<%@ Page language="c#" Codebehind="Authors.aspx.cs" AutoEventWireup="false" Inherits="First.Authors" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
<HTML>
<HEAD>
<meta name="GENERATOR" Content="Microsoft Visual Studio 7.0">
<meta name="CODE_LANGUAGE" Content="C#">
<meta name="vs_defaultClientScript" content="JavaScript (ECMAScript)">
<meta name="vs_targetSchema" content="http://schemas.microsoft.com/intellisense/ie5">
</HEAD>
<body MS_POSITIONING="GridLayout">
<form id="Authors" method="post" runat="server">
<asp:DataGrid id="MyDataGrid" style="Z-INDEX: 101; LEFT: 145px; POSITION: absolute; TOP: 131px" runat="server" Width="404px" Height="127px" BorderColor="Black" Font-Names="Verdana" Font-Size="X-Small" AllowPaging="True" PageSize="5" ShowFooter="True"></asp:DataGrid>
</form>
</body>
</HTML>authors.aspx.cs内容如下using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;namespace First
{
/// <summary>
/// Summary description for Authors.
/// </summary>
public class Authors : System.Web.UI.Page
{
protected System.Web.UI.WebControls.DataGrid MyDataGrid; protected System.Data.DataSet ds;

public Authors()
{
Page.Init += new System.EventHandler(Page_Init);
} private void Page_Load(object sender, System.EventArgs e)
{
// Put user code to initialize the page here
ds = new System.Data.DataSet(); System.Data.OleDb.OleDbConnection conn = new System.Data.OleDb.OleDbConnection(
"Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=pubs;Data Source=OCEAN;Use Procedure for Prepare=1;Auto Translate=True;Packet Size=4096;Workstation ID=OCEAN;Use Encryption for Data=False;Tag with column collation when possible=False");
System.Data.OleDb.OleDbDataAdapter myAdapter = new System.Data.OleDb.OleDbDataAdapter(
"Select au_id, au_lname, au_fname from authors", conn);
myAdapter.Fill(ds,"authors");
MyDataGrid.DataSource = ds.Tables["authors"].DefaultView;
MyDataGrid.DataBind();
} private void Page_Init(object sender, EventArgs e)
{
//
// CODEGEN: This call is required by the ASP.NET Web Form Designer.
//
InitializeComponent();
} #region Web Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{    
this.MyDataGrid.PageIndexChanged += new System.Web.UI.WebControls.DataGridPageChangedEventHandler(this.MyDataGrid_PageIndexChanged);
this.Load += new System.EventHandler(this.Page_Load); }
#endregion private void MyDataGrid_PageIndexChanged(object source, System.Web.UI.WebControls.DataGridPageChangedEventArgs e)
{
MyDataGrid.CurrentPageIndex = e.NewPageIndex;
MyDataGrid.DataBind();
}
}
}