wy_yzwyh_mod.aspx

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

ASPX
143
字号
<%@ 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 wy_owner_info where id=" & cint(theid)
                     cmd=new sqlcommand(sql,cnn)
                     datar=cmd.executereader()
                     if datar.read() then
                        code.text=Iif(IsDbNull(datar("code")),"",datar("code"))
                        name.text=Iif(IsDbNull(datar("name")),"",datar("name"))
                        zhiw.text=Iif(IsDbNull(datar("duty")),"",datar("duty"))
                        sex.text=Iif(IsDbNull(datar("sex")),"",datar("sex"))
                        tel.text=Iif(IsDbNull(datar("tel")),"",datar("tel"))
                        birth.text=Iif(IsDbNull(datar("birth")),"",datar("birth"))
                        work.text=Iif(IsDbNull(datar("works")),"",datar("works"))
                        jj.text=Iif(IsDbNull(datar("jj")),"",datar("jj"))
                        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 CodeStr as string=code.text
                  dim NameStr as string=name.text
                  dim zwStr as string=zhiw.text
                  dim sexstr as string=sex.text
                  dim telstr as string=tel.text
                  dim birthstr as string=birth.text
                  dim workstr as string=work.text
                  dim jjstr as string=jj.text
                  dim memostr as string=memo.text
                  dim sql as string
                  dim dataR as sqldatareader
    
                  cnn=new sqlconnection(configurationsettings.appsettings("connection"))
                  cnn.open()
                  sql="update wy_owner_info set code='" & codestr & "',name='" & namestr & "',duty='" & zwstr & "',birth='" & birthstr & "',sex='" & sexstr & "',tel='" & telstr & "',works='" & workstr & "',jj='" & jjstr & "',memo='" & memostr & "' where id=" & cint(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="80%" align="center" border="0">
            <tbody>
                <tr class="tr4">
                    <td height="40">
                        成员编号
                        <asp:TextBox class="input_text" id="code" runat="server" width="140"></asp:TextBox>
                    </td>
                    <td>
                        成员姓名
                        <asp:TextBox class="input_text" id="name" runat="server" width="140"></asp:TextBox>
                    </td>
                    <td>
                        所属职务
                        <asp:TextBox class="input_text" id="zhiw" runat="server" width="140"></asp:TextBox>
                    </td>
                </tr>
                <tr class="tr4">
                    <td width="34%" height="40">
                        成员性别
                        <asp:TextBox class="input_text" id="sex" runat="server" width="140"></asp:TextBox>
                    </td>
                    <td width="33%">
                        出生日期
                        <asp:TextBox class="input_text" id="birth" runat="server" width="140"></asp:TextBox>
                    </td>
                    <td width="33%">
                        联系电话
                        <asp:TextBox class="input_text" id="tel" runat="server" width="140"></asp:TextBox>
                    </td>
                </tr>
                <tr class="tr4">
                    <td colspan="3" height="40">
                        工作单位
                        <asp:TextBox class="input_text" id="work" runat="server" width="580"></asp:TextBox>
                    </td>
                </tr>
                <tr class="tr4">
                    <td valign="top" colspan="3" height="100">
                        个人简介<br />
                        <asp:TextBox id="jj" runat="server" width="660" Rows="4" TextMode="MultiLine"></asp:TextBox>
                    </td>
                </tr>
                <tr class="tr4">
                    <td colspan="3" height="40">
                        备&nbsp;&nbsp;&nbsp;&nbsp;注
                        <asp:TextBox class="input_text" id="memo" runat="server" width="580"></asp:TextBox>
                    </td>
                </tr>
            </tbody>
        </table><br>
	<center>
	<asp:button class="input_button" id="SaveBtn" onclick="Save_Click" runat="server" text="修  改"></asp:button>
        <br><br>
        <asp:RequiredFieldValidator id="Requiredfieldvalidator1" runat="server" ControlToValidate="code" ErrorMessage="*">成员代码不可为空</asp:RequiredFieldValidator>
        <br />
        <asp:RequiredFieldValidator id="Requiredfieldvalidator2" runat="server" ControlToValidate="name" ErrorMessage="*">成员名称不可为空</asp:RequiredFieldValidator>
    </form>
</body>
</html>

⌨️ 快捷键说明

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