感觉自己现在写程序越来越多了,真烦恼啊~~~
<%@ page language="c#" EnableSessionState="True" %>
<%@ Import Namespace="System.IO" %>
<%@ Import Namespace="System.Data" %>
<%@ Import Namespace="System.Data.OleDb" %>
<html>
<head>
<title>test</title>
<script language="c#" runat="server">
DataSet rs =new DataSet();
public void Page_load(Object src,EventArgs e)
{
string sql="select * from test";
string myconnstr="Provider=Microsoft.Jet.OLEDB.4.0; Data Source="+ Server.MapPath("test.mdb");
OleDbConnection myconn=new OleDbConnection(myconnstr);
OleDbDataAdapter myadapter=new OleDbDataAdapter(sql,myconn);
myadapter.Fill(rs,"name");
name.DataSource=rs.Tables["name"].DefaultView;
name.DataBind();
}
</script>
</head>
<body>
<asp:DataGrid id="name" runat="server" Headerstyle-BackColor="#aaaadd" AlternatingItemStyle-BackColor="#eeeeee"/>
</body>
</html>
<%@ page language="c#" EnableSessionState="True" %>
<%@ Import Namespace="System.IO" %>
<%@ Import Namespace="System.Data" %>
<%@ Import Namespace="System.Data.OleDb" %>
<html>
<head>
<title>test</title>
<script language="c#" runat="server">
DataSet rs =new DataSet();
public void Page_load(Object src,EventArgs e)
{
string sql="select * from test";
string myconnstr="Provider=Microsoft.Jet.OLEDB.4.0; Data Source="+ Server.MapPath("test.mdb");
OleDbConnection myconn=new OleDbConnection(myconnstr);
OleDbDataAdapter myadapter=new OleDbDataAdapter(sql,myconn);
myadapter.Fill(rs,"name");
name.DataSource=rs.Tables["name"].DefaultView;
name.DataBind();
}
</script>
</head>
<body>
<asp:DataGrid id="name" runat="server" Headerstyle-BackColor="#aaaadd" AlternatingItemStyle-BackColor="#eeeeee"/>
</body>
</html>
回复Comments
作者:
{commentrecontent}