代码如下:<form runat="server">
<asp:DataGrid AutoGenerateColumns="false" OnItemCreated="itemcreate" DataKeyField="link_id" ID="mydg" runat="server" >
<columns>
<asp:TemplateColumn>
<headertemplate>
<asp:CheckBox ID="checkall" OnCheckedChanged="chkall_onchanged" AutoPostBack="true" runat="server"></asp:CheckBox>
</headertemplate>
<itemtemplate>
<asp:CheckBox ID="checkdel" runat="server"></asp:CheckBox>
</itemtemplate>
</asp:TemplateColumn>
<asp:BoundColumn DataField="link_id" HeaderText="Link_Id" ></asp:BoundColumn>
<asp:BoundColumn HeaderText="网站名称" DataField="sitename" />
<asp:BoundColumn HeaderText="网站地址" DataField="url" />
<asp:BoundColumn HeaderText="网站介绍" DataField="intro" />
<asp:BoundColumn HeaderText="网站评分" DataField="grade" />
<asp:BoundColumn HeaderText="提交时间" DataField="submit_date"></asp:BoundColumn>
</columns>
</asp:DataGrid>
<asp:Label ID="lb1" runat="server"></asp:Label>
<asp:Button ID="btn1" Text="删 除" runat="server" OnClick="btn1_onclick"></asp:Button>
<asp:Button ID="ok" OnClick="ok_click" Text="保存修改" runat="server"></asp:Button>
<asp:Button ID="cancel" OnClick="cancel_click" Text="取消修改" runat="server"></asp:Button>
</form>
<%@ import namespace="system.data"%>
<%@ import namespace="system.data.oledb"%>
<script language="vb" runat="server">
dim conn as oledbconnection
dim ds as dataset
sub Page_load(sender as object,e as eventargs)
if not ispostback then
calldb()
else
ds=session("ds")
end if
end sub
sub calldb()
conn = new oledbconnection("provider=Microsoft.jet.oledb.4.0;data source="& server.MapPath("wwwlink.mdb"))
dim sqlstr="select * from link"
conn.open()
dim adp as new oledbdataAdapter(sqlstr,conn)
ds =new dataset()
adp.fill(ds,"link")
mydg.DataSource=ds.tables("link").defaultview
mydg.databind()
conn.close()
session("ds")=ds
end sub
sub btn1_onclick(sender as object, e as eventargs)
新闻热点
疑难解答
图片精选