📄 dataset1.aspx
字号:
<% @ Page Language="C#" %>
<% @ Import Namespace="System.Data" %>
<% @ Import Namespace="System.Data.OleDb" %>
<Script Language="C#" Runat="Server">
public void Page_Load(Object src,EventArgs e)
{
//各种String的设置
string MyConnString = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source="+Server.MapPath("..\\DataBase\\db1.mdb")+";";
string strSel1 = "select * from UserList";
string strSel2 = "select * from Score";
string strSel3 = "select * from BookMark";
DataSet MyDataSet = new DataSet();
OleDbConnection MyConnection = new OleDbConnection(MyConnString);
//打开DataAdapter
OleDbDataAdapter MyAdapter1 = new OleDbDataAdapter(strSel1,MyConnection);
OleDbDataAdapter MyAdapter2 = new OleDbDataAdapter(strSel2,MyConnection);
OleDbDataAdapter MyAdapter3 = new OleDbDataAdapter(strSel3,MyConnection);
//将各表的数据,存入DataSet
MyAdapter1.Fill(MyDataSet,"UserList");
MyAdapter2.Fill(MyDataSet,"Score");
MyAdapter3.Fill(MyDataSet,"BookMark");
//交给DataGrid去显示
DataGrid1.DataSource = MyDataSet.Tables["UserList"].DefaultView;
DataGrid2.DataSource = MyDataSet.Tables["Score"].DefaultView;
DataGrid3.DataSource = MyDataSet.Tables["BookMark"].DefaultView;
DataGrid1.DataBind();
DataGrid2.DataBind();
DataGrid3.DataBind();
}
</script>
<html>
<head>
<title></title>
</head>
<body>
<form runat="server">
<ASP:DataGrid id="DataGrid1" runat="server"
AllowPaging="True"
PageSize="5"
PagerStyle-Mode="NumericPages"
BorderColor="black"
BorderWidth="1"
GridLines="Both"
CellPadding="3"
CellSpacing="0"
Font-Name="Verdana"
Font-Size="8pt"
HeaderStyle-BackColor="#aaaadd"
AlternatingItemStyle-BackColor="#eeeeee"
/>
<hr>
<ASP:DataGrid id="DataGrid2" runat="server"
AllowPaging="True"
PageSize="4"
PagerStyle-Mode="NumericPages"
BorderColor="black"
BorderWidth="1"
GridLines="Both"
CellPadding="3"
CellSpacing="0"
Font-Name="Verdana"
Font-Size="8pt"
HeaderStyle-BackColor="#aaaadd"
AlternatingItemStyle-BackColor="#eeeeee"
/>
<hr>
<ASP:DataGrid id="DataGrid3" runat="server"
AllowPaging="True"
PageSize="4"
PagerStyle-Mode="NumericPages"
BorderColor="black"
BorderWidth="1"
GridLines="Both"
CellPadding="3"
CellSpacing="0"
Font-Name="Verdana"
Font-Size="8pt"
HeaderStyle-BackColor="#aaaadd"
AlternatingItemStyle-BackColor="#eeeeee"
/>
</form>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -