📄 hzxx.aspx
字号:
<%@ Page Language="VB" Debug="true" %>
<%@ import Namespace="system.data" %>
<%@ import Namespace="system.data.sqlclient" %>
<script runat="server">
dim Cnn as sqlconnection
dim cmd as sqlcommand
Sub Page_Load(Sender As Object, E As EventArgs)
dim Sql as string
dim dataR as sqldatareader
If Not IsPostBack Then
If Session("curruser") = "" Then
Response.Redirect("../index.aspx")
End If
end if
End Sub
Sub save_click(Sender As Object, E As EventArgs)
dim sql as string
dim sql1 as string
dim datar as sqldatareader
dim dycode as string
dim dystr as string=dyname.text
dim namestr as string=name.text
dim birdatestr as string=birdate.text
dim sexstr as string=sex.selecteditem.value
dim khhstr as string=khh.text
dim yhzhstr as string=yhzh.text
dim zjhmstr as string=zjhm.text
dim zjlxstr as string=zjlx.selecteditem.value
dim gzdwstr as string=gzdw.text
dim zwstr as string=zw.text
dim szpcsstr as string=szpcs.text
dim lxdhstr as string=lxdh.text
dim jgstr as string=jg.text
dim lxdzstr as string=lxdz.text
dim zipstr as string=zip.text
dim rzrqstr as string=rzrq.text
dim statestr as string=state.selecteditem.value
dim memostr as string=memo.text
if trim(dystr)="" then
page.registerstartupscript("",getalertinfo("请输入单元名称!"))
exit sub
end if
if trim(namestr)="" then
page.registerstartupscript("",getalertinfo("户主姓名不可为空!"))
exit sub
end if
cnn=new sqlconnection(configurationsettings.appsettings("connection"))
sql="select * from fc_cell where name='" & trim(dystr) & "'"
cmd=new sqlcommand(sql,cnn)
cnn.open
datar=cmd.executereader()
if datar.read() then
dycode=datar("code")
else
page.registerstartupscript("",getalertinfo("该单元不存在,数据无法保存!"))
exit sub
end if
datar.close()
sql="select * from zh_master where cellcode='" & trim(dycode) & "'"
cmd=new sqlcommand(sql,cnn)
datar=cmd.executereader()
if datar.read() then
sql="update zh_master set name='" & namestr & "',state='" & statestr & "',birdate='" & birdatestr & "',sex='" & sexstr & "',khh='" & khhstr & "',yhzh='" & yhzhstr & "',gzdw='" & gzdwstr & "',zw='" & zwstr & "',szpcs='" & szpcsstr & "',jg='" & jgstr & "',zjhm='" & zjhmstr & "',zjlx='" & zjlxstr & "',lxdh='" & lxdhstr & "',lxdz='" & lxdzstr & "',zip='" & zipstr & "',rzrq='" & rzrqstr & "',memo='" & memostr & "' where cellcode='" & dycode & "'"
else
sql="insert into zh_master(cellcode,state,rzrq,name,birdate,sex,khh,yhzh,gzdw,zw,szpcs,jg,zjhm,zjlx,lxdh,lxdz,zip,memo) values('" & dycode & "','" & statestr & "','" & rzrqstr & "','" & namestr & "','" & birdatestr & "','" & sexstr & "','" & khhstr & "','" & yhzhstr & "','" & gzdwstr & "','" & zwstr & "','" & szpcsstr & "','" & jgstr & "','" & zjhmstr & "','" & zjlxstr & "','" & lxdhstr & "','" & lxdzstr & "','" & zipstr & "','" & memostr & "')"
end if
datar.close()
cmd=new sqlcommand(sql,cnn)
cmd.executenonquery
call cleardata()
page.registerstartupscript("",getalertinfo("数据保存成功!"))
End Sub
Function GetAlertInfo(byval str1 as string) as String
dim Str2 as String
str2="<script language='javascript'>alert('" & str1 & "')<"
str2+="/"
str2+="script>"
return trim(str2)
End Function
sub cleardata()
name.text=""
birdate.text=""
khh.text=""
yhzh.text=""
zjhm.text=""
gzdw.text=""
zw.text=""
szpcs.text=""
lxdh.text=""
jg.text=""
lxdz.text=""
zip.text=""
rzrq.text=""
memo.text=""
end sub
Sub sure_click(Sender As Object, E As EventArgs)
dim sql as string
dim datar as sqldatareader
dim dystr as string=dyname.text
if trim(dystr)="" then
page.registerstartupscript("",getalertinfo("请输入单元名称!"))
else
cnn=new sqlconnection(configurationsettings.appsettings("connection"))
sql="select code from fc_cell where name='" & trim(dystr) & "'"
cmd=new sqlcommand(sql,cnn)
cnn.open
datar=cmd.executereader()
if datar.read() then
datar.close()
call cleardata()
sql="select * from zh_master where cellcode in (select code from fc_cell where name='" & trim(dystr) & "')"
cmd=new sqlcommand(sql,cnn)
datar=cmd.executereader()
if datar.read() then
dim sexstr as string=datar("sex")
dim zjlxstr as string=datar("zjlx")
dim statestr as string=datar("state")
name.text=Iif(IsDbNull(datar("name")),"",datar("name"))
birdate.text=Iif(IsDbNull(datar("birdate")),"",datar("birdate"))
khh.text=Iif(IsDbNull(datar("khh")),"",datar("khh"))
yhzh.text=Iif(IsDbNull(datar("yhzh")),"",datar("yhzh"))
zjhm.text=Iif(IsDbNull(datar("zjhm")),"",datar("zjhm"))
gzdw.text=Iif(IsDbNull(datar("gzdw")),"",datar("gzdw"))
zw.text=Iif(IsDbNull(datar("zw")),"",datar("zw"))
szpcs.text=Iif(IsDbNull(datar("szpcs")),"",datar("szpcs"))
lxdh.text=Iif(IsDbNull(datar("lxdh")),"",datar("lxdh"))
jg.text=Iif(IsDbNull(datar("jg")),"",datar("jg"))
lxdz.text=Iif(IsDbNull(datar("lxdz")),"",datar("lxdz"))
zip.text=Iif(IsDbNull(datar("zip")),"",datar("zip"))
rzrq.text=Iif(IsDbNull(datar("rzrq")),"",datar("rzrq"))
memo.text=Iif(IsDbNull(datar("memo")),"",datar("memo"))
select case sexstr
case "男"
sex.selectedindex=0
case "女"
sex.selectedindex=1
end select
select case statestr
case "出租"
state.selectedindex=0
case "自住"
state.selectedindex=1
end select
select case zjlxstr
case "身份证"
zjlx.selectedindex=0
case "户口本"
zjlx.selectedindex=1
case "其它证件"
zjlx.selectedindex=2
end select
end if
else
page.registerstartupscript("",getalertinfo("该单元不存在,请重新输入!"))
end if
datar.close()
end if
End Sub
</script>
<html>
<head>
<title>户主信息</title>
<link href="../Main.css" type="text/css" rel="stylesheet" />
</head>
<body background="../images/1.jpg">
<form runat="server">
<table id="search" cellspacing="1" cellpadding="0" width="90%" align="center" border="0">
<tbody>
<tr class="tr4">
<td width="34%" height="30">
单元名称
<asp:TextBox class="input_text" id="dyname" runat="server" width="130"></asp:TextBox>
</td>
<td>
<asp:button class="input_button" id="SureBtn" onclick="Sure_Click" runat="server" text="确 定"></asp:button>
</td>
<td></td>
</tr>
<tr><td colspan=3><hr></td></tr>
<tr>
<td width="34%" height="30">
业主姓名
<asp:TextBox class="input_text" id="name" runat="server" width="130"></asp:TextBox>
</td>
<td width="33%">
出生日期
<asp:TextBox class="input_text" id="birdate" runat="server" width="130"></asp:TextBox>
</td>
<td width="33%">
性 别
<asp:DropDownList class="input_text" id="sex" runat="server" width="130">
<asp:ListItem Value="男" selected="true">男</asp:ListItem>
<asp:ListItem Value="女">女</asp:ListItem>
</asp:DropDownList>
</td>
</tr>
<tr class="tr4">
<td width="34%" height="30">
状 态
<asp:DropDownList id="state" runat="server" width="130">
<asp:ListItem Value="出租" selected="true">出租</asp:ListItem>
<asp:ListItem Value="自住">自住</asp:ListItem>
</asp:DropDownList>
</td>
<td width="33%">
籍 贯
<asp:TextBox class="input_text" id="jg" runat="server" width="130"></asp:TextBox>
</td>
<td width="33%">
入住日期
<asp:TextBox class="input_text" id="rzrq" runat="server" width="130"></asp:TextBox>
</td>
</tr>
<tr class="tr4">
<td colspan="2">
开 户 行
<asp:TextBox class="input_text" id="khh" runat="server" width="390"></asp:TextBox>
</td>
<td height="30">
银行账号
<asp:TextBox class="input_text" id="yhzh" runat="server" width="130"></asp:TextBox>
</td>
</tr>
<tr>
<td width="34%" height="30">
证件类型
<asp:DropDownList class="input_text" id="zjlx" runat="server" width="130">
<asp:ListItem Value="身份证" selected="true">身份证</asp:ListItem>
<asp:ListItem Value="户口本">户口本</asp:ListItem>
<asp:ListItem Value="其他证件">其他证件</asp:ListItem>
</asp:DropDownList>
</td>
<td width="33%">
证件号码
<asp:TextBox class="input_text" id="zjhm" runat="server" width="130"></asp:TextBox>
</td>
<td width="33%">
邮 编
<asp:TextBox class="input_text" id="zip" runat="server" width="130"></asp:TextBox>
</td>
</tr>
<tr class="tr4">
<td colspan="2">
工作单位
<asp:TextBox class="input_text" id="gzdw" runat="server" width="390"></asp:TextBox>
</td>
<td height="30">
职 务
<asp:TextBox class="input_text" id="zw" runat="server" width="130"></asp:TextBox>
</td>
</tr>
<tr class="tr4">
<td colspan="2">
联系地址
<asp:TextBox class="input_text" id="lxdz" runat="server" width="390"></asp:TextBox>
</td>
<td height="30">
联系电话
<asp:TextBox class="input_text" id="lxdh" runat="server" width="130"></asp:TextBox>
</td>
</tr>
<tr class="tr4">
<td colspan="3" height="30">
所在派出所
<asp:TextBox class="input_text" id="szpcs" runat="server" width="630"></asp:TextBox>
</td>
</tr>
<tr class="tr4">
<td colspan="3" height="30">
备注信息
<asp:TextBox class="input_text" id="memo" runat="server" width="640"></asp:TextBox>
</td>
</tr>
<tr class="tr4">
<td valign="bottom" align="middle" colspan="3" height="40">
<asp:button class="input_button" id="SaveBtn" onclick="Save_Click" runat="server" text="保 存"></asp:button>
</td>
</tr>
</tbody>
</table>
</form>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -