⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 zhcy_mod.aspx

📁 ASP.NET开发实战详解
💻 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
              shared str3 as string
              Sub Page_Load(Sender As Object, E As EventArgs)
                  dim sql as string
		  dim i as integer
                  str3="<script language='javascript'>window.close()<"
                  str3+="/"
                  str3+="script>"
                  if Not IsPostBack then
                     dim theid as string=trim(request.querystring("id"))
                     dim thetag as string=trim(request.querystring("tag"))	
                     dim datar as sqldatareader
                     if thetag="add" then
                        title.text="住户成员信息增加"
                        if theid="" then
                           page.registerstartupscript("",getalertinfo("该单元信息不存在,无法增加住户成员!"))
                           Page.RegisterStartupScript("StartUp",str3)
                        else
                           cnn=new sqlconnection(configurationsettings.appsettings("connection"))
                           cnn.open()
                           sql="select a.code,a.name,b.name as lp,c.name as lg from fc_cell a,fc_lp b,fc_lg c where c.lpcode=b.code and a.lgcode=c.code and a.name='" & theid & "'"
                           cmd=new sqlcommand(sql,cnn)
                           datar=cmd.executereader()
                           if datar.read() then                           
			      name.text=datar("name")
			      lg.text=datar("lg")
			      lp.text=datar("lp")
                           end if
                           datar.close()
                        end if
                     else
                        title.text="住户成员信息修改"
                        cnn=new sqlconnection(configurationsettings.appsettings("connection"))
                        cnn.open()
                        sql="select a.code,a.name,b.name as lp,c.name as lg,d.name as cyname,d.* from fc_cell a,fc_lp b,fc_lg c,zh_members d where c.lpcode=b.code and a.lgcode=c.code and cellcode=a.code and d.id=" & theid
                        cmd=new sqlcommand(sql,cnn)
                        datar=cmd.executereader()
                        if datar.read() then                           
			   name.text=datar("name")
			   lg.text=datar("lg")
			   lp.text=datar("lp")
	         	   cyname.text=Iif(IsDbNull(datar("cyname")),"",datar("cyname"))
			   birdata.text=Iif(IsDbNull(datar("birdate")),"",datar("birdate"))
		           ration.text=Iif(IsDbNull(datar("ration")),"",datar("ration"))
	        	   zjhm.text=Iif(IsDbNull(datar("zjhm")),"",datar("zjhm"))
		           memo.text=Iif(IsDbNull(datar("memo")),"",datar("memo"))
                           dim zjlxstr as string=datar("zjlx")
                           dim sexstr as string=datar("sex")
                           select case sexstr
                           case "男"
                              sex.selectedindex=0	
                           case "女"
                              sex.selectedindex=1
                           end select                		
                           select case zjlxstr
                           case "身份证"
                              zjlx.selectedindex=0	
                           case "户口本"
                              zjlx.selectedindex=1
                           case "其他证件"
                              zjlx.selectedindex=2
                           end select
                           cyname.enabled="false"  
                        end if
                        datar.close()
                     end if
                  End if
              End Sub

              Sub Save_Click(Sender As Object, E As EventArgs)
                  dim theid as string=trim(request.querystring("id"))
                  dim CellCodeStr as string
                  dim thetag as string=trim(request.querystring("tag"))
	          dim sexstr=sex.selecteditem.value
                  dim zjlxstr=zjlx.selecteditem.value
 		  dim namestr=cyname.text
		  dim birdatastr=birdata.text
		  dim rationstr=ration.text
		  dim zjhmstr=zjhm.text
		  dim memostr=memo.text
                  dim sql as string
                  dim datar as sqldatareader
                  cnn=new sqlconnection(configurationsettings.appsettings("connection"))
                  cnn.open()
                  if namestr="" then
                     page.registerstartupscript("",getalertinfo("成员姓名不可为空!")) 
                     exit sub
                  end if
                  if thetag="mod" then
                     sql="update zh_members set birdate='" & birdatastr & "',sex='" & sexstr & "',ration='" & rationstr & "',zjhm='" & zjhmstr & "',zjlx='" & zjlxstr & "',memo='" & memostr & "' where id=" & theid
                     cmd=new sqlcommand(sql,cnn)
                     cmd.executenonquery
                     cnn.close
                  else
                     sql="select code from fc_cell where name='" & theid & "'"
                     cmd=new sqlcommand(sql,cnn)
                     datar=cmd.executereader()
                     if datar.read() then
                        cellcodestr=datar("code")
                        datar.close() 
                        sql="insert into zh_members(cellcode,name,birdate,sex,ration,zjhm,zjlx,memo) values('" & cellcodestr & "','" & namestr & "','" & birdatastr & "','" & sexstr & "','" & rationstr & "','" & zjhmstr & "','" & zjlxstr & "','" & memostr & "')"
                        cmd=new sqlcommand(sql,cnn)
                        cmd.executenonquery
                        cnn.close
                     end if
                  end if
                  Page.RegisterStartupScript("",str3)
              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

</script>
<html>
<head>
    <title>住户成员</title>
    <base target="_self" />
</head>
<body background="../images/2.jpg">
    <form runat="server">
        <br><p align="center"><asp:Label id="title" runat="server" forecolor="Blue" font-bold="True" font-size="Large" font-names="隶书"></asp:Label></p>
        <font style="color:blue">单元名称:</font>
	<asp:label id="name" runat="server" forecolor="Red" font-bold="True"></asp:label>&nbsp;&nbsp;
        <font style="color:blue">所属楼盘:</font>
	<asp:label id="lp" runat="server" forecolor="Red" font-bold="True"></asp:label>&nbsp;&nbsp;
        <font style="color:blue">所属楼阁:</font>
	<asp:label id="lg" runat="server" forecolor="Red" font-bold="True"></asp:label>
        <hr>
                <table id="search" cellspacing="1" cellpadding="0" width="90%" align="center" border="0">
                        <tr class="tr4">
                            <td height="60" width="34%">
                                姓&nbsp;&nbsp;&nbsp;&nbsp;名
                                <asp:TextBox class="input_text" id="cyname" runat="server" width="120"></asp:TextBox>
			    </td>
                            <td width="33%">
                                出生日期
                                <asp:TextBox class="input_text" id="birdata" runat="server" width="120"></asp:TextBox>
                            </td>
                            <td width="33%">
                                性&nbsp;&nbsp;&nbsp;&nbsp;别
                                <asp:DropDownList class="input_text" id="sex" runat="server" width="120">
	                           <asp:ListItem Value="男" selected="true">男</asp:ListItem>
		  	           <asp:ListItem Value="女">女</asp:ListItem>
  			        </asp:DropDownList>
			    </td>	
                        </tr>
                        <tr class="tr4">
                            <td height="50" width="34%">
                                与户主关系
                                <asp:TextBox class="input_text" id="ration" runat="server" width="100"></asp:TextBox>
                            </td>
                            <td width="33%">
                                证件类型
                                <asp:DropDownList class="input_text" id="zjlx" runat="server" width="120">
	                          <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="120"></asp:TextBox>
                            </td>
                        </tr>
                        <tr class="tr4">
                            <td colspan="3" height="50">
                            备注信息
                            <asp:TextBox class="input_text" id="memo" runat="server" width="530"></asp:TextBox>
                            </td>
                        </tr>
                        <tr class="tr4">
                            <td valign="bottom" align="middle" colspan="3" height="70">
                                <asp:button class="input_button" id="SaveBtn" onclick="Save_Click" runat="server" text="保  存"></asp:button>
                            </td>
                        </tr>
                </table>
    </form>
</body>
</html>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -