xj_js_mod.aspx

来自「ASP.NET开发实战详解」· ASPX 代码 · 共 175 行

ASPX
175
字号
<%@ 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 typestr as string
	          dim zjtypestr as string
                  str3="<script language='javascript'>window.close()<"
                  str3+="/"
                  str3+="script>"
                  if Not IsPostBack then
                     dim theid as string=trim(request.querystring("id"))
                     dim datar as sqldatareader
                     cnn=new sqlconnection(configurationsettings.appsettings("connection"))
                     cnn.open()
                     sql="select * from xj_info where id=" & theid
                     cmd=new sqlcommand(sql,cnn)
                     datar=cmd.executereader()
                     if datar.read() then
	                sdate.text=Iif(IsDbNull(datar("sdate")),"",datar("sdate"))
                        ldate.text=Iif(IsDbNull(datar("ldate")),"",datar("ldate"))
                        sdw.text=Iif(IsDbNull(datar("sdw")),"",datar("sdw"))
			num.text=iif(isdbnull(datar("num")),"",datar("num"))
                        ljr.text=Iif(IsDbNull(datar("ljr")),"",datar("ljr"))
                        zj.text=Iif(IsDbNull(datar("zj")),"",datar("zj"))
                        agent.text=Iif(IsDbNull(datar("agent")),"",datar("agent"))
			typestr=Iif(IsDbNull(datar("ttype")),"",datar("ttype"))
                        zjtypestr=Iif(IsDbNull(datar("zjtype")),"",datar("zjtype"))
                        memo.text=Iif(IsDbNull(datar("memo")),"",datar("memo"))
			select case typestr
			case "特快专递"
			   seltype.selectedindex=0	
			case "包裹"
			   seltype.selectedindex=1
			case "一般信件"
			   seltype.selectedindex=2
			end select
			select case zjtypestr
			case "身份证"
			   selzj.selectedindex=0	
			case "户口本"
			   selzj.selectedindex=1
			case "其它证件"
			   selzj.selectedindex=2
			end select

                     Else
                        page.registerstartupscript("",getalertinfo("该来访记录不存在,可能已被删除!"))
                        Page.RegisterStartupScript("StartUp",str3)
                     End if
                     datar.close()
                  End if
              End Sub

              Sub Save_Click(Sender As Object, E As EventArgs)
                  dim theid as string=trim(request.querystring("id"))
                  dim sdateStr as string=sdate.text
                  dim ldateStr as string=ldate.text
                  dim typestr as string=seltype.selecteditem.value
                  dim sdwstr as string=sdw.text
                  dim numstr as string=num.text
                  dim ljrstr as string=ljr.text
                  dim zjtypestr as string=selzj.selecteditem.value
                  dim zjstr as string=zj.text
                  dim agentstr as string=agent.text
                  dim memostr as string=memo.text
                  dim sql as string
                  cnn=new sqlconnection(configurationsettings.appsettings("connection"))
                  cnn.open()
                  sql="update xj_info set sdate='" & sdatestr & "',ldate='" & ldatestr & "',ttype='" & typestr & "',sdw='" & sdwstr & "',num=" & numstr & ",ljr='" & ljrstr & "',zjtype='" & zjtypestr & "',zj='" & zjstr & "',agent='" & agentstr & "',memo='" & memostr & "' where id=" & theid
                  cmd=new sqlcommand(sql,cnn)
                  cmd.executenonquery
                  cnn.close
                  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"><font style="color:blue" face="隶书" size="6"><strong>信件信息修改</strong></font></p>
        <font style="color:blue">当前信件ID:</font><font style="color:red"><%=request.querystring("id")%></font>
        <hr>
                <table id="search" cellspacing="1" cellpadding="0" width="90%" align="center" border="0">
                    <tbody>
                        <tr class="tr4">
                            <td width="34%" height="40">
                                收件日期
                                <asp:TextBox class="input_text" id="sdate" runat="server" width="120"></asp:TextBox>
                            </td>
                            <td colspan=2 height="40">
                                收件单位
                                <asp:TextBox class="input_text" id="sdw" runat="server" width="329"></asp:TextBox>
                            </td>
                        </tr>
                        <tr class="tr4">
                            <td  height="40">
                                邮件类别
                                <asp:DropDownList class="input_text" id="Seltype" runat="server" width="120">
				   <asp:ListItem Value="特快专递">特快专递</asp:ListItem>
				   <asp:ListItem Value="包裹">包裹</asp:ListItem>
				   <asp:ListItem Value="一般信件">一般信件</asp:ListItem>
				</asp:DropDownList>
                            </td>
                            <td>
                                数&nbsp;&nbsp;&nbsp;&nbsp;量
                                <asp:TextBox class="input_text" id="num" runat="server" width="120"></asp:TextBox>
                            </td>
                            <td>
                                经&nbsp;手&nbsp;人
                                <asp:TextBox class="input_text" id="agent" runat="server" width="120"></asp:TextBox>
                            </td>
                        </tr>
                        <tr class="tr4">
                            <td span=3 height="20"></td>
                        </tr>
                        <tr class="tr4">
                            <td height="40">
                                领&nbsp;件&nbsp;人
                                <asp:TextBox class="input_text" id="ljr" runat="server" width="120"></asp:TextBox>
                            </td>
                            <td>
                                证件类别
                                <asp:DropDownList class="input_text" id="Selzj" runat="server" width="120">
				   <asp:ListItem Value="身份证">身份证</asp:ListItem>
				   <asp:ListItem Value="户口本">户口本</asp:ListItem>
				   <asp:ListItem Value="其它证件">其它证件</asp:ListItem>
				</asp:DropDownList>
                            </td>
                            <td>
                                证件号码
                                <asp:TextBox class="input_text" id="zj" runat="server" width="120"></asp:TextBox>
                            </td>
                        </tr>
                        <tr class="tr4"  height="40">
                            <td>
                                领取日期
                                <asp:TextBox class="input_text" id="ldate" runat="server" width="120"></asp:TextBox>
                            </td>
                            <td colspan="2" height="40">
                                备&nbsp;&nbsp;&nbsp;&nbsp;注
                                <asp:TextBox class="input_text" id="memo" runat="server" width="329"></asp:TextBox>
                            </td>
                        </tr>
                        <tr class="tr4">
                            <td valign="bottom" align="middle" colspan="3" height="130">
                                <asp:button class="input_button" id="SaveBtn" onclick="Save_Click" runat="server" text="保  存"></asp:button>
                                <br />
                                <asp:RequiredFieldValidator id="Requiredfieldvalidator1" runat="server" ErrorMessage="*" ControlToValidate="sdate">收件日期不可为空</asp:RequiredFieldValidator><br />
                                <asp:RequiredFieldValidator id="Requiredfieldvalidator2" runat="server" ErrorMessage="*" ControlToValidate="sdw">收件单位不可为空</asp:RequiredFieldValidator>
                            </td>
                        </tr>
                    </tbody>
                </table>
    </form>
</body>
</html>

⌨️ 快捷键说明

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