📄 super.aspx
字号:
<%@ import namespace="system.data" %>
<%@ import namespace="system.data.oledb" %>
<html>
<script language="vb" runat="server">
public ds as dataset=new dataset()
public shared i as integer=1
public shared str1 as string
sub page_load(obj as object,e as eventargs)
if session("pass")<>"ok" then
response.redirect("login.aspx")
end if
p1.visible=false
p2.visible=true
p5.visible=false
str1="provider=microsoft.jet.oledb.4.0;data source="&server.mappath("lt.mdb")
dim str2 as string="select id as 主题编号,title as 主题标题 from zt"
dim ad as oledbdataadapter
ad=new oledbdataadapter(str2,str1)
ad.fill(ds,"zt")
dim dv as dataview=ds.tables("zt").defaultview
g2.datasource=dv
g2.databind()
str2="select id as 发言编号, to_id as 讨论主题,rq as 发言日期 from news order by rq"
dim ad1 as oledbdataadapter
ad1=new oledbdataadapter(str2,str1)
ad1.fill(ds,"news")
dim dv1 as dataview=ds.tables("news").defaultview
g3.datasource=dv1
g3.databind()
end sub
sub dele(obj as object,e as datagridcommandeventargs)
dim ztno as string
dim str2 as string
ztno=ds.tables("zt").rows(e.item.itemindex).item("主题编号")
str2="delete from zt where id="&ztno
dim ad as oledbdataadapter
ad=new oledbdataadapter(str2,str1)
ad.fill(ds,"zt")
ds.tables("zt").clear()
str2="select id as 主题编号,title as 主题标题 from zt"
ad=new oledbdataadapter(str2,str1)
ad.fill(ds,"zt")
dim dv as dataview=ds.tables("zt").defaultview
g2.datasource=dv
g2.databind()
p1.visible="true"
p2.visible="false"
p5.visible="false"
end sub
sub fy_delec(obj as object,e as eventargs)
p1.visible="false"
p2.visible="false"
p5.visible="true"
end sub
sub fy_delec1(obj as object,e as datagridcommandeventargs)
dim fyno as string
dim str2 as string
fyno=ds.tables("news").rows(e.item.itemindex).item("发言编号")
str2="delete from news where id="&fyno
dim ad as oledbdataadapter
ad=new oledbdataadapter(str2,str1)
ad.fill(ds,"news")
'刷新显示
ds.tables("news").clear()
str2="select id as 发言编号, to_id as 讨论主题,rq as 发言日期 from news order by rq"
dim ad1 as oledbdataadapter
ad1=new oledbdataadapter(str2,str1)
ad1.fill(ds,"news")
dim dv as dataview=ds.tables("news").defaultview
g3.datasource=dv
g3.databind()
p1.visible="false"
p2.visible="false"
p5.visible="true"
end sub
sub go_addc(obj as object,e as eventargs)
p1.visible=false
p5.visible=false
p2.visible=true
end sub
sub add_okc(obj as object,e as eventargs)
dim str2 as string
dim ad as oledbdataadapter
str2="select * from zt"
ad=new oledbdataadapter(str2,str1)
ds.tables("zt").clear()
ad.fill(ds,"zt")
dim r1 as datarow=ds.tables("zt").newrow()
r1.item("title")=trim(zt_title.text)
r1.item("mem")=trim(zt_mem.text)
ds.tables("zt").rows.add(r1)
dim dcb as new oledbcommandbuilder(ad)
ad.update(ds,"zt")
ds.clear()
str2="select id as 主题编号,title as 主题标题 from zt"
ad.dispose()
ad=new oledbdataadapter(str2,str1)
ad.fill(ds,"zt")
dim dv as dataview=ds.tables("zt").defaultview
g2.datasource=dv
g2.databind()
end sub
sub go_delec(obj as object,e as eventargs)
p1.visible="true"
p2.visible="false"
p5.visible="false"
end sub
</script>
<form id="f1" runat="server">
<asp:panel id="p4" runat="server" horizontalalign="center">
<asp:panel id="p3" runat="server" horizontalalign="center">
<asp:linkbutton id="go_add" runat="server" onclick="go_addc" text="增加主题"/>
<asp:linkbutton id="go_dele" runat="server" onclick="go_delec" text="删除主题"/>
<asp:hyperlink id="go" runat="server" navigateurl="lt.aspx" text="我要去参加讨论了!"/>
<asp:linkbutton id="fy_dele" runat="server" onclick="fy_delec" text="删除发言"/>
<br><br>
</asp:panel>
<hr>
<asp:panel id="p1" runat="server" horizontalalign="center">
<asp:datagrid id="g2" runat="server" width="400"
ondeletecommand="dele"
allowpaging="false" >
<Headerstyle backcolor="silver" Horizontalalign="center"/>
<Itemstyle backcolor="#ccffff" Horizontalalign="center"/>
<Alternatingitemstyle backcolor="#ffffff"/>
<Footerstyle backcolor="#009999" />
<headerstyle backcolor="silver" horizontalalign="center"/>
<columns>
<asp:buttoncolumn headertext="删除" text="删除" buttontype="linkbutton" commandname="delete" />
</columns>
</asp:datagrid>
</asp:panel>
<asp:panel id="p5" runat="server" horizontalalign="center">
<asp:datagrid id="g3" runat="server" width="400"
ondeletecommand="fy_delec1"
allowpaging="false" >
<Headerstyle backcolor="silver" Horizontalalign="center"/>
<Itemstyle backcolor="#ccffff" Horizontalalign="center"/>
<Alternatingitemstyle backcolor="#ffffff"/>
<Footerstyle backcolor="#009999" />
<headerstyle backcolor="silver" horizontalalign="center"/>
<columns>
<asp:buttoncolumn headertext="删除" text="删除" buttontype="linkbutton" commandname="delete" />
</columns>
</asp:datagrid>
</asp:panel>
<asp:panel id="p2" runat="server" horizontalalign="center" backcolor="silver" width="500">
主题标题<br><asp:textbox id="zt_title" runat="server" columns="60"/><br>
主题内容<br><asp:textbox id="zt_mem" runat="server" textmode="multiline" rows="8" columns="60"/><br>
<asp:button id="add_ok" runat="server" text="添加" onclick="add_okc"/>
</asp:panel>
</asp:panel>
</form>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -