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

📄 zhyf.aspx

📁 ASP.NET开发实战详解
💻 ASPX
📖 第 1 页 / 共 2 页
字号:
<%@ 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
      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 sql2 as string
      dim sql3 as string
      dim sql4 as string
      dim datar as sqldatareader
      dim dycode as string
      dim dystr as string=dyname.text
      dim yfdatestr as string=yfdate.text
      dim sldatestr as string=sldate.text
      dim memostr as string=memo.text
      dim ch_hgstr as string=selch.selecteditem.value
      dim ch_zhyjstr as string=ch_zhyj.text
      dim ch_glyyjstr as string=ch_glyyj.text
      dim ct_hgstr as string=selct.selecteditem.value
      dim ct_zhyjstr as string=ct_zhyj.text
      dim ct_glyyjstr as string=ct_glyyj.text
      dim db_hgstr as string=seldb.selecteditem.value
      dim db_zhyjstr as string=db_zhyj.text
      dim db_glyyjstr as string=db_glyyj.text
      dim qm_hgstr as string=selqm.selecteditem.value
      dim qm_zhyjstr as string=qm_zhyj.text
      dim qm_glyyjstr as string=qm_glyyj.text
      dim thb_hgstr as string=selthb.selecteditem.value
      dim thb_zhyjstr as string=thb_zhyj.text
      dim thb_glyyjstr as string=thb_glyyj.text

      if trim(dystr)="" 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_zhyf where cellcode='" & trim(dycode) & "'"
      cmd=new sqlcommand(sql,cnn)
      datar=cmd.executereader()
      if datar.read() then
          sql="update zh_zhyf set yfdate='" & yfdatestr & "',sldate='" & sldatestr & "',memo='" & memostr & "',hg='" & ch_hgstr & "',zhyj='" & ch_zhyjstr & "',glyyj='" & ch_glyyjstr & "' where cellcode='" & dycode & "' and item='窗户'"
          sql1="update zh_zhyf set yfdate='" & yfdatestr & "',sldate='" & sldatestr & "',memo='" & memostr & "',hg='" & ct_hgstr & "',zhyj='" & ct_zhyjstr & "',glyyj='" & ct_glyyjstr & "' where cellcode='" & dycode & "' and item='窗台'"
          sql2="update zh_zhyf set yfdate='" & yfdatestr & "',sldate='" & sldatestr & "',memo='" & memostr & "',hg='" & db_hgstr & "',zhyj='" & db_zhyjstr & "',glyyj='" & db_glyyjstr & "' where cellcode='" & dycode & "' and item='地板'"
          sql3="update zh_zhyf set yfdate='" & yfdatestr & "',sldate='" & sldatestr & "',memo='" & memostr & "',hg='" & qm_hgstr & "',zhyj='" & qm_zhyjstr & "',glyyj='" & qm_glyyjstr & "' where cellcode='" & dycode & "' and item='墙面'"
          sql4="update zh_zhyf set yfdate='" & yfdatestr & "',sldate='" & sldatestr & "',memo='" & memostr & "',hg='" & thb_hgstr & "',zhyj='" & thb_zhyjstr & "',glyyj='" & thb_glyyjstr & "' where cellcode='" & dycode & "' and item='天花板'"
      else
          sql="insert into zh_zhyf(cellcode,yfdate,sldate,item,hg,zhyj,glyyj,memo) values('" & dycode & "','" & yfdatestr & "','" & sldatestr & "','窗户','" & ch_hgstr & "','" & ch_zhyjstr & "','" & ch_glyyjstr & "','" & memostr & "')"
          sql1="insert into zh_zhyf(cellcode,yfdate,sldate,item,hg,zhyj,glyyj,memo) values('" & dycode & "','" & yfdatestr & "','" & sldatestr & "','窗台','" & ct_hgstr & "','" & ct_zhyjstr & "','" & ct_glyyjstr & "','" & memostr & "')"
          sql2="insert into zh_zhyf(cellcode,yfdate,sldate,item,hg,zhyj,glyyj,memo) values('" & dycode & "','" & yfdatestr & "','" & sldatestr & "','地板','" & db_hgstr & "','" & db_zhyjstr & "','" & db_glyyjstr & "','" & memostr & "')"
          sql3="insert into zh_zhyf(cellcode,yfdate,sldate,item,hg,zhyj,glyyj,memo) values('" & dycode & "','" & yfdatestr & "','" & sldatestr & "','墙面','" & qm_hgstr & "','" & qm_zhyjstr & "','" & qm_glyyjstr & "','" & memostr & "')"
          sql4="insert into zh_zhyf(cellcode,yfdate,sldate,item,hg,zhyj,glyyj,memo) values('" & dycode & "','" & yfdatestr & "','" & sldatestr & "','天花板','" & thb_hgstr & "','" & thb_zhyjstr & "','" & thb_glyyjstr & "','" & memostr & "')"
      end if
      datar.close()
      cmd=new sqlcommand(sql,cnn)
      cmd.executenonquery
      cmd=new sqlcommand(sql1,cnn)
      cmd.executenonquery
      cmd=new sqlcommand(sql2,cnn)
      cmd.executenonquery
      cmd=new sqlcommand(sql3,cnn)
      cmd.executenonquery
      cmd=new sqlcommand(sql4,cnn)
      cmd.executenonquery
      dyname.text=""
      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()
      yfdate.text=""
      sldate.text=""
      memo.text=""
      ch_zhyj.text=""
      ch_glyyj.text=""
      ct_zhyj.text=""
      ct_glyyj.text=""
      db_zhyj.text=""
      db_glyyj.text=""
      qm_zhyj.text=""
      qm_glyyj.text=""
      thb_zhyj.text=""
      thb_glyyj.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_zhyf where cellcode in (select code from fc_cell where name='" & trim(dystr) & "')"
            cmd=new sqlcommand(sql,cnn)
            datar=cmd.executereader()
            do while (datar.read())
               sldate.text=Iif(IsDbNull(datar("sldate")),"",datar("sldate"))
               yfdate.text=Iif(IsDbNull(datar("yfdate")),"",datar("yfdate"))
               memo.text=Iif(IsDbNull(datar("memo")),"",datar("memo"))

               select case datar("item")
               case "窗户"
                  ch_zhyj.text=Iif(IsDbNull(datar("zhyj")),"",datar("zhyj"))
                  ch_glyyj.text=Iif(IsDbNull(datar("glyyj")),"",datar("glyyj"))
                  if datar("hg")="不合格" then
                     selch.selectedindex=1
                  else  
                     selch.selectedindex=0
                  end if
               case "窗台"
                  ct_zhyj.text=Iif(IsDbNull(datar("zhyj")),"",datar("zhyj"))
                  ct_glyyj.text=Iif(IsDbNull(datar("glyyj")),"",datar("glyyj"))
                  if datar("hg")="不合格" then
                     selct.selectedindex=1
                  else  
                     selct.selectedindex=0
                  end if
               case "墙面"
                  qm_zhyj.text=Iif(IsDbNull(datar("zhyj")),"",datar("zhyj"))
                  qm_glyyj.text=Iif(IsDbNull(datar("glyyj")),"",datar("glyyj"))
                  if datar("hg")="不合格" then
                     selqm.selectedindex=1
                  else  
                     selqm.selectedindex=0
                  end if
               case "地板"
                  db_zhyj.text=Iif(IsDbNull(datar("zhyj")),"",datar("zhyj"))
                  db_glyyj.text=Iif(IsDbNull(datar("glyyj")),"",datar("glyyj"))
                  if datar("hg")="不合格" then
                     seldb.selectedindex=1
                  else  

⌨️ 快捷键说明

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