📄 userinfo.aspx
字号:
<%@ import namespace="system.data"%>
<%@ import namespace="system.data.oledb"%>
<html>
<script language="vb" runat="server">
sub page_load(obj as object,e as eventargs)
if session("pass")<>"ok" then
response.redirect("login.aspx")
end if
if page.ispostback=false then
dim str1 as string
dim str2 as string
str1="provider=microsoft.jet.oledb.4.0;data source="&server.mappath("..\bo_store.mdb")
str2="select * from user1 where id="&trim(request("id"))
dim ad as oledbdataadapter
ad=new oledbdataadapter(str2,str1)
dim ds as dataset=new dataset()
ad.fill(ds,"user")
userid.text=ds.tables("user").rows(0).item("userid")
username.text=ds.tables("user").rows(0).item("username")
psd.text=ds.tables("user").rows(0).item("psd")
str2=ds.tables("user").rows(0).item("sex")
if str2="男" then
sex.items(0).selected="true"
elseif str2="女" then
sex.items(1).selected="true"
end if
age.text=ds.tables("user").rows(0).item("age")
email.text=ds.tables("user").rows(0).item("email")
addr.text=ds.tables("user").rows(0).item("addr")
tele.text=ds.tables("user").rows(0).item("tele")
end if
end sub
sub b1_click(obj as object,e as eventargs)
dim str1 as string
dim str2 as string
str1="provider=microsoft.jet.oledb.4.0;data source="&server.mappath("..\bo_store.mdb")
str2="update user1 set userid='"&trim(userid.text)& _
"', username='"&trim(username.text)& _
"', psd='"&trim(psd.text)& _
"', userdj='2'"& _
", sex='"&trim(sex.selecteditem.text)& _
"', age="&trim(age.text)& _
", email='"&trim(email.text)& _
"', tele='"&trim(tele.text)& _
"', addr='"&trim(addr.text)& _
"' where userid='"&trim(userid.text)&"'"
dim ad as oledbdataadapter
ad=new oledbdataadapter(str2,str1)
dim ds as dataset=new dataset()
ad.fill(ds,"user")
end sub
</script>
<asp:panel id="p1" runat="server" horizontalalign="center">
<form id="form1" runat="server">
<asp:table id="table2" runat="server" backcolor="silver" gridlines="both" horizontalalign="center" width="400">
<asp:tablerow id="row20" runat="server" bgcolor="blue">
<asp:tablecell id="cell20" runat="server" Colspan=2 >
<font color="yellow">用户信息</font></asp:tablecell>
</asp:tablerow>
<asp:tablerow id="row21" runat="server" >
<asp:tablecell id="cell211" runat="server" horizontalalign="center" width=80>用户号</asp:tablecell>
<asp:tablecell id="cell212" runat="server" bgcolor="#ffffff"><asp:textbox id="userid" runat="server" enabled=false/></asp:tablecell>
</asp:tablerow>
<asp:tablerow id="row25" runat="server" >
<asp:tablecell id="cell251" runat="server" horizontalalign="center">用户名</asp:tablecell>
<asp:tablecell id="cell252" runat="server" bgcolor="#ffffff"><asp:textbox id="username" runat="server"/></asp:tablecell>
</asp:tablerow>
<asp:tablerow id="row22" runat="server">
<asp:tablecell id="cell221" runat="server" horizontalalign="center">密 码</asp:tablecell>
<asp:tablecell id="cell222" runat="server" bgcolor="#ffffff"><asp:textbox id="psd" runat="server" /></asp:tablecell></asp:tablerow>
<asp:tablerow id="row23" runat="server">
<asp:tablecell id="cell231" runat="server" horizontalalign="center">性 别</asp:tablecell>
<asp:tablecell id="cell232" runat="server" bgcolor="#ffffff">
<asp:radiobuttonlist id="sex" repeatdirection="horizontal" runat="server">
<asp:listitem text="男"/>
<asp:listitem text="女"/>
</asp:radiobuttonlist>
</asp:tablecell></asp:tablerow>
<asp:tablerow id="row26" runat="server">
<asp:tablecell id="cell261" runat="server" horizontalalign="center">年 龄</asp:tablecell>
<asp:tablecell id="cell262" runat="server" bgcolor="#ffffff"><asp:textbox id="age" runat="server" /></asp:tablecell></asp:tablerow>
<asp:tablerow id="row24" runat="server">
<asp:tablecell id="cell241" runat="server" horizontalalign="center">e-mail</asp:tablecell>
<asp:tablecell id="cell242" runat="server" bgcolor="#ffffff"><asp:textbox id="email" runat="server" size="45"/></asp:tablecell></asp:tablerow>
<asp:tablerow id="row27" runat="server">
<asp:tablecell id="cell271" runat="server" horizontalalign="center">电 话</asp:tablecell>
<asp:tablecell id="cell272" runat="server" bgcolor="#ffffff"><asp:textbox id="tele" runat="server" size="45"/></asp:tablecell></asp:tablerow>
<asp:tablerow id="row28" runat="server">
<asp:tablecell id="cell281" runat="server" horizontalalign="center" width=80>通讯地址</asp:tablecell>
<asp:tablecell id="cell282" runat="server" bgcolor="#ffffff"><asp:textbox id="addr" runat="server" size="45"/></asp:tablecell></asp:tablerow>
</asp:table>
<asp:linkbutton id="go1" runat="server" onclick="b1_click" text="确定修改"/><br><br>
<asp:hyperlink id="go2" runat="server" navigateurl="news.aspx" text="不改信息了,我要去看网页了!"/><br><br>
</form>
</asp:panel>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -