📄 index.aspx
字号:
<%@ Page Language="VB" %>
<%@ import Namespace="System.Data" %>
<%@ import Namespace="System.Data.OleDb" %>
<script runat="server">
sub page_load
dim conn as oledbconnection
dim da as oledbdataadapter
dim ds as dataset
dim sql as string
sql="select top 10 * from notice order by id desc"
conn=new OleDbConnection("Provider=Microsoft.Jet.OleDb.4.0;Data Source="+Server.MapPath("notice.mdb"))
da=new oledbdataadapter(sql,conn)
ds =new dataset
da.fill(ds,"notice") '还可以这样简单的写:da.fill(ds)
datagrid1.datasource=ds.tables("notice").defaultview ''还可以这样简单的写:datagrid1.datasource=ds
datagrid1.databind()
end sub
Sub Button1_Click(sender As Object, e As EventArgs)
response.redirect("add.aspx")
End Sub
Sub Button2_Click(sender As Object, e As EventArgs)
response.redirect("more.aspx")
End Sub
</script>
<html>
<head>
</head>
<body>
<form runat="server">
<table style="WIDTH: 765px; HEIGHT: 41px" cellspacing="0" cellpadding="0" width="765" align="center" border="1">
<tbody>
<tr>
<td bgcolor="royalblue">
<p align="center">
<font color="white"><strong>公司最新10条通知</strong></font>
</p>
</td>
</tr>
</tbody>
</table>
<p align="center">
<asp:Button id="Button1" onclick="Button1_Click" runat="server" BackColor="#E0E0E0" BorderColor="SteelBlue" BorderWidth="1px" Text="发布新通知"></asp:Button>
<asp:Button id="Button2" onclick="Button2_Click" runat="server" BackColor="#E0E0E0" BorderColor="SteelBlue" BorderWidth="1px" Text="查看以前的通知"></asp:Button>
</p>
<p align="right">
<asp:DataGrid id="DataGrid1" runat="server" BackColor="White" BorderColor="White" BorderWidth="2px" CellSpacing="1" GridLines="None" Font-Size="Smaller" HorizontalAlign="Center" AutoGenerateColumns="False" Width="765px" CellPadding="3" BorderStyle="Ridge">
<FooterStyle forecolor="Black" backcolor="#C6C3C6"></FooterStyle>
<HeaderStyle font-bold="True" forecolor="#E7E7FF" backcolor="#4A3C8C"></HeaderStyle>
<PagerStyle horizontalalign="Right" forecolor="Black" backcolor="#C6C3C6"></PagerStyle>
<SelectedItemStyle font-bold="True" forecolor="White" backcolor="#9471DE"></SelectedItemStyle>
<ItemStyle forecolor="Black" backcolor="#DEDFDE"></ItemStyle>
<Columns>
<asp:HyperLinkColumn Target="_blank" DataNavigateUrlField="id" DataNavigateUrlFormatString="shown.aspx?id={0}" DataTextField="title" HeaderText="标题"></asp:HyperLinkColumn>
<asp:BoundColumn DataField="data" HeaderText="发布日期"></asp:BoundColumn>
</Columns>
</asp:DataGrid>
</p>
<p align="center">
<font color="#400000" size="2"></font>
</p>
<p align="center">
</p>
<p align="center">
<font color="#400000" size="2"></font>
</p>
<font color="#400000" size="2"></font>
<p align="center">
<font color="#400000" size="2">All Rights Reserved By Decision 2004</font>
</p>
</form>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -