tcc_cl_mod.aspx

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

ASPX
162
字号
<%@ 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
                  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 tcc_car_info where cpcode='" & theid & "'"
                     cmd=new sqlcommand(sql,cnn)
                     datar=cmd.executereader()
                     if datar.read() then
	                cpcode.text=Iif(IsDbNull(datar("cpcode")),"",datar("cpcode"))
                        czname.text=Iif(IsDbNull(datar("czname")),"",datar("czname"))
                        xs.text=Iif(IsDbNull(datar("xs")),"",datar("xs"))
			zj.text=iif(isdbnull(datar("zj")),"",datar("zj"))
                        dy.text=Iif(IsDbNull(datar("dy")),"",datar("dy"))
                        tel.text=Iif(IsDbNull(datar("tel")),"",datar("tel"))
                        tz.text=Iif(IsDbNull(datar("tz")),"",datar("tz"))
                        tcz.text=Iif(IsDbNull(datar("tcz")),"",datar("tcz"))
                        sdate.text=Iif(IsDbNull(datar("sdate")),"",datar("sdate"))
                        edate.text=Iif(IsDbNull(datar("edate")),"",datar("edate"))
                        agent.text=Iif(IsDbNull(datar("agent")),"",datar("agent"))
                        memo.text=Iif(IsDbNull(datar("memo")),"",datar("memo"))
                     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 cznameStr as string=czname.text
                  dim xsStr as string=xs.text
                  dim zjstr as string=zj.text
                  dim dystr as string=dy.text
                  dim telstr as string=tel.text
                  dim tzstr as string=tz.text
                  dim tczstr as string=tcz.text
                  dim sdatestr as string=sdate.text
                  dim edatestr as string=edate.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 tcc_car_info set czname='" & cznamestr & "',xs='" & xsstr & "',zj='" & zjstr & "',dy='" & dystr & "',tel='" & telstr & "',tz='" & tzstr & "',tcz='" & tczstr & "',sdate='" & sdatestr & "',edate='" & edatestr & "',agent='" & agentstr & "',memo='" & memostr & "' where cpcode='" & 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">当前车牌号:</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">
                                车&nbsp;牌&nbsp;号
                                <asp:TextBox class="input_text" enabled="false" id="cpcode" runat="server" width="120"></asp:TextBox>
                            </td>
                            <td width="33%">
                                车主姓名
                                <asp:TextBox class="input_text" id="czname" runat="server" width="120"></asp:TextBox>
                            </td>
                            <td width="33%">
                                行驶证号
                                <asp:TextBox class="input_text" id="xs" runat="server" width="120"></asp:TextBox>
                            </td>
                        </tr>
                        <tr class="tr4">
                            <td width="34%" height="40">
                                身份证号
                                <asp:TextBox class="input_text" id="zj" runat="server" width="120"></asp:TextBox>
                            </td>
                            <td>
                                所属单元
                                <asp:TextBox class="input_text" id="dy" runat="server" width="120"></asp:TextBox>
                            </td>
                            <td>
                                联系电话
                                <asp:TextBox class="input_text" id="tel" runat="server" width="120"></asp:TextBox>
                            </td>
                        </tr>
                        <tr class="tr4">
                            <td colspan="3" height="40">
                                车辆特征
                                <asp:TextBox class="input_text" id="tz" runat="server" width="560"></asp:TextBox>
                            </td>
                        </tr>
                        <tr class="tr4">
                            <td colspan=3 height="10"><br></td>
                        </tr>
                        <tr class="tr4">
                            <td height="40">
                                停车证号
                                <asp:TextBox class="input_text" id="tcz" runat="server" width="120"></asp:TextBox>
                            </td>
                            <td>
                                开始日期
                                <asp:TextBox class="input_text" id="sdate" runat="server" width="120"></asp:TextBox>
                            </td>
                            <td>
                                到期日期
                                <asp:TextBox class="input_text" id="edate" runat="server" width="120"></asp:TextBox>
                            </td>
                        </tr>
                        <tr class="tr4">
                            <td height="40">
                                经&nbsp;办&nbsp;人
                                <asp:TextBox class="input_text" id="agent" runat="server" width="120"></asp:TextBox>
                            </td>
                            <td colspan=2>
                                备&nbsp;&nbsp;&nbsp;&nbsp;注
                                <asp:TextBox class="input_text" id="memo" runat="server" width="330"></asp:TextBox>
                            </td>
                        </tr>
                        <tr class="tr4">
                            <td valign="bottom" align="middle" colspan="3" height="100">
                                <asp:button class="input_button" id="SaveBtn" onclick="Save_Click" runat="server" text="保  存"></asp:button>
                                <br />
                                <asp:RequiredFieldValidator id="Requiredfieldvalidator1" runat="server" ErrorMessage="*" ControlToValidate="cpcode">车牌号不可为空</asp:RequiredFieldValidator><br />
                                <asp:RequiredFieldValidator id="Requiredfieldvalidator2" runat="server" ErrorMessage="*" ControlToValidate="czname">车主姓名不可为空</asp:RequiredFieldValidator><br>
                            </td>
                        </tr>
                    </tbody>
                </table>
    </form>
</body>
</html>

⌨️ 快捷键说明

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