| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 423 人关注过本帖
标题:我在ASP程序中增加内容,为什么不运行
只看楼主 加入收藏
风大陆
Rank: 1
等 级:新手上路
帖 子:3
专家分:0
注 册:2009-12-24
结帖率:0
收藏
已结贴  问题点数:20 回复次数:3 
我在ASP程序中增加内容,为什么不运行
<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<!--#include file="Connections/connqx.asp" -->
<%
' *** Restrict Access To Page: Grant or deny access to this page
MM_authorizedUsers="3"
MM_authFailedURL="login.asp"
MM_grantAccess=false
If Session("MM_Username") <> "" Then
  If (false Or CStr(Session("MM_UserAuthorization"))="") Or _
         (InStr(1,MM_authorizedUsers,Session("MM_UserAuthorization"))>=1) Then
    MM_grantAccess = true
  End If
End If
If Not MM_grantAccess Then
  MM_qsChar = "?"
  If (InStr(1,MM_authFailedURL,"?") >= 1) Then MM_qsChar = "&"
  MM_referrer = Request.ServerVariables("URL")
  if (Len(Request.QueryString()) > 0) Then MM_referrer = MM_referrer & "?" & Request.QueryString()
  MM_authFailedURL = MM_authFailedURL & MM_qsChar & "accessdenied=" & Server.URLEncode(MM_referrer)
  Response.Redirect(MM_authFailedURL)
End If
%>
<%
' *** Edit Operations: declare variables

Dim MM_editAction
Dim MM_abortEdit
Dim MM_editQuery
Dim MM_editCmd

Dim MM_editConnection
Dim MM_editTable
Dim MM_editRedirectUrl
Dim MM_editColumn
Dim MM_recordId

Dim MM_fieldsStr
Dim MM_columnsStr
Dim MM_fields
Dim MM_columns
Dim MM_typeArray
Dim MM_formVal
Dim MM_delim
Dim MM_altVal
Dim MM_emptyVal
Dim MM_i

MM_editAction = CStr(Request.ServerVariables("SCRIPT_NAME"))
If (Request.QueryString <> "") Then
  MM_editAction = MM_editAction & "?" & Request.QueryString
End If

' boolean to abort record edit
MM_abortEdit = false

' query string to execute
MM_editQuery = ""
%>
<%
' *** Update Record: set variables

If (CStr(Request("MM_update")) = "form1" And CStr(Request("MM_recordId")) <> "") Then

  MM_editConnection = MM_connqx_STRING
  MM_editTable = "dbo.qx"
  MM_editColumn = "ID1"
  MM_recordId = "" + Request.Form("MM_recordId") + ""
  MM_editRedirectUrl = "list.asp"
  MM_fieldsStr  = "缺陷分级|value|审核结果|value|审核备注|value|审核时间|value|审核人|value|审核单位|value|状态|value"
  MM_columnsStr = "缺陷分级|',none,''|审核结果|',none,''|审核备注|',none,''|审核时间|',none,NULL|审核人|',none,''|审核单位|',none,''|状态|none,none,NULL"

  ' create the MM_fields and MM_columns arrays
  MM_fields = Split(MM_fieldsStr, "|")
  MM_columns = Split(MM_columnsStr, "|")
  
  ' set the form values
  For MM_i = LBound(MM_fields) To UBound(MM_fields) Step 2
    MM_fields(MM_i+1) = CStr(Request.Form(MM_fields(MM_i)))
  Next
  
   '缺陷状态置位,小修或停机改缺陷分级
    select case MM_fields(3)
   
     case "及时消缺"  
       MM_fields(13)="9"
      
     case "同意合并处理"  
        MM_fields(13)="5"
        
     case "同意停机处理"  
        MM_fields(13)="6"
        MM_fields(1)="三类"
     case "纳入小修计划"
      
        MM_fields(13)="7"
        MM_fields(1)="三类"
        
     end select
  ' append the query string to the redirect URL
  If (MM_editRedirectUrl <> "" And Request.QueryString <> "") Then
    If (InStr(1, MM_editRedirectUrl, "?", vbTextCompare) = 0 And Request.QueryString <> "") Then
      MM_editRedirectUrl = MM_editRedirectUrl & "?" & Request.QueryString
    Else
      MM_editRedirectUrl = MM_editRedirectUrl & "&" & Request.QueryString
    End If
  End If

End If
%>
<%
' *** Update Record: construct a sql update statement and execute it

If (CStr(Request("MM_update")) <> "" And CStr(Request("MM_recordId")) <> "") Then

  ' create the sql update statement
  MM_editQuery = "update " & MM_editTable & " set "
  For MM_i = LBound(MM_fields) To UBound(MM_fields) Step 2
    MM_formVal = MM_fields(MM_i+1)
    MM_typeArray = Split(MM_columns(MM_i+1),",")
    MM_delim = MM_typeArray(0)
    If (MM_delim = "none") Then MM_delim = ""
    MM_altVal = MM_typeArray(1)
    If (MM_altVal = "none") Then MM_altVal = ""
    MM_emptyVal = MM_typeArray(2)
    If (MM_emptyVal = "none") Then MM_emptyVal = ""
    If (MM_formVal = "") Then
      MM_formVal = MM_emptyVal
    Else
      If (MM_altVal <> "") Then
        MM_formVal = MM_altVal
      ElseIf (MM_delim = "'") Then  ' escape quotes
        MM_formVal = "'" & Replace(MM_formVal,"'","''") & "'"
      Else
        MM_formVal = MM_delim + MM_formVal + MM_delim
      End If
    End If
    If (MM_i <> LBound(MM_fields)) Then
      MM_editQuery = MM_editQuery & ","
    End If
    MM_editQuery = MM_editQuery & MM_columns(MM_i) & " = " & MM_formVal
  Next
  MM_editQuery = MM_editQuery & " where " & MM_editColumn & " = " & MM_recordId

  If (Not MM_abortEdit) Then
    ' execute the update
    Set MM_editCmd = Server.CreateObject(")
    MM_editCmd.ActiveConnection = MM_editConnection
    MM_ = MM_editQuery
    MM_editCmd.Execute
    MM_editCmd.ActiveConnection.Close

    If (MM_editRedirectUrl <> "") Then
      Response.Redirect(MM_editRedirectUrl)
    End If
  End If

End If
%>
<%
Dim Recordset1
Dim Recordset1_numRows

Set Recordset1 = Server.CreateObject("ADODB.Recordset")
Recordset1.ActiveConnection = MM_connqx_STRING
Recordset1.Source = "SELECT 发现单位  FROM yx"
Recordset1.CursorType = 0
Recordset1.CursorLocation = 2
Recordset1.LockType = 1
Recordset1.Open()

Recordset1_numRows = 0
%>
<%
Dim Recordset2
Dim Recordset2_numRows

Set Recordset2 = Server.CreateObject("ADODB.Recordset")
Recordset2.ActiveConnection = MM_connqx_STRING
Recordset2.Source = "SELECT 审核单位 FROM dbo.sh ORDER BY id DESC"
Recordset2.CursorType = 0
Recordset2.CursorLocation = 2
Recordset2.LockType = 1
Recordset2.Open()

Recordset2_numRows = 0
%>
<%
Dim rslist__MMColParam
rslist__MMColParam = "1"
If (Request.QueryString("ID1") <> "") Then
  rslist__MMColParam = Request.QueryString("ID1")
End If
%>

<%
Dim rslist
Dim rslist_numRows

Set rslist = Server.CreateObject("ADODB.Recordset")
rslist.ActiveConnection = MM_connqx_STRING
rslist.Source = "SELECT *  FROM dbo.qx  WHERE ID1 = " + Replace(rslist__MMColParam, "'", "''") + ""
rslist.CursorType = 0
rslist.CursorLocation = 2
rslist.LockType = 3
rslist.Open()

rslist_numRows = 0
%><html>
<script language="JavaScript" type="text/JavaScript">
<!--
function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_validateForm() { //v4.0
  var i,p,q,nm,test,num,min,max,errors='',args=MM_validateForm.arguments;
  for (i=0; i<(args.length-2); i+=3) { test=args[i+2]; val=MM_findObj(args[i]);
    if (val) { nm=val.name; if ((val=val.value)!="") {
      if (test.indexOf('isEmail')!=-1) { p=val.indexOf('@');
        if (p<1 || p==(val.length-1)) errors+='- '+nm+' must contain an e-mail address.\n';
      } else if (test!='R') { num = parseFloat(val);
        if (isNaN(val)) errors+='- '+nm+' must contain a number.\n';
        if (test.indexOf('inRange') != -1) { p=test.indexOf(':');
          min=test.substring(8,p); max=test.substring(p+1);
          if (num<min || max<num) errors+='- '+nm+' must contain a number between '+min+' and '+max+'.\n';
    } } } else if (test.charAt(0) == 'R') errors += '- '+nm+' is required.\n'; }
  } if (errors) alert('The following error(s) occurred:\n'+errors);
  document.MM_returnValue = (errors == '');
}
//-->
</script>
<body>
<form ACTION="<%=MM_editAction%>" METHOD="POST" name="form1" onSubmit="MM_validateForm('验收人','','R');return document.MM_returnValue">
  <table width="80%" border="0" align="center" cellspacing="0" class="skin-info2">
   
    <tr>
      <td align="right" valign="top">
        <table width="100%" border="1" align="center" dwcopytype="CopyTableRow">
          <tr class="skin-info2">
            <td width="25%" align="default">ID1</td>
            <td width="75%" align="default"><%=(rslist.Fields.Item("ID1").Value)%></td>
          </tr>
          <tr class="skin-info2">
            <td width="25%" align="default">状态</td>
            <td width="75%" align="default">
             <% select case  rslist.Fields.Item("状态").Value %>
         
             <% case "0" %>
             <img src="img/qxed.gif" align="absmiddle">
            
             <% case "1" %>
             <img src="img/xqing.gif"  align="absmiddle">
            
             <% case "3" %>
             <img src="img/xqyc.gif"  align="absmiddle">
            
             <% case "5" %>
             <img src="img/hbcl.gif" align="absmiddle">
            
             <% case "6" %>
             <img src="img/tjcl.gif"  align="absmiddle">
              
             <% case "7" %>
             <img src="img/xxcl.gif"  align="absmiddle">
            
             <% case "9" %>
             <img src="img/qxyx.gif"  align="absmiddle">
            
            <%  end select %> </td>
          </tr>
          <tr class="skin-info2">
            <td width="25%" align="default">缺陷分级</td>
            <td width="75%" align="default"><%=(rslist.Fields.Item("缺陷分级").Value)%>            <input name="缺陷分级" type="hidden" id="缺陷分级" value="<%=(rslist.Fields.Item("缺陷分级").Value)%>"></td>
          </tr>
          <tr class="skin-info2">
            <td width="25%" align="default">缺陷分类</td>
            <td width="75%" align="default"><%=(rslist.Fields.Item("缺陷分类").Value)%></td>
          </tr>
          <tr class="skin-info2">
            <td width="25%" align="default">机组</td>
            <td width="75%" align="default"><%=(rslist.Fields.Item("机组").Value)%></td>
          </tr>
          <tr class="skin-info2">
            <td width="25%" align="default">设备</td>
            <td width="75%" align="default"><%=(rslist.Fields.Item("设备").Value)%></td>
          </tr>
          <tr class="skin-info2">
            <td width="25%" align="default">缺陷内容</td>
            <td width="75%" align="default"><%=(rslist.Fields.Item("缺陷内容").Value)%></td>
          </tr>
          <tr class="skin-info2">
            <td width="25%" align="default">发现人</td>
            <td width="75%" align="default"><%=(rslist.Fields.Item("发现人").Value)%></td>
          </tr>
          <tr class="skin-info2">
            <td width="25%" align="default">发现时间</td>
            <td width="75%" align="default"><%=(rslist.Fields.Item("发现时间").Value)%></td>
          </tr>
          <tr class="skin-info2">
            <td width="25%" align="default">登缺确认人</td>
            <td width="75%" align="default"><%=(rslist.Fields.Item("确认人").Value)%></td>
          </tr>
        
          <tr class="skin-info1">
            <td width="24%" align="default">接收人</td>
            <td width="76%" align="default"><%=(rslist.Fields.Item("接收人").Value)%></td>
          </tr>
          <tr class="skin-info1">
            <td align="default">接收确认人</td>
            <td align="default"><%=(rslist.Fields.Item("接收确认人").Value)%></td>
          </tr>
          <tr class="skin-info1">
            <td width="24%" align="default">接收时间</td>
            <td width="76%" align="default"><%=(rslist.Fields.Item("接收时间").Value)%></td>
          </tr>
          <tr class="skin-info1">
            <td width="24%" align="default">检修结果</td>
            <td width="76%" align="default"><%=(rslist.Fields.Item("检修结果").Value)%></td>
          </tr>
          <tr class="skin-info1">
            <td width="24%" align="default">检修交待</td>
            <td width="76%" align="default"><%=(rslist.Fields.Item("检修交代").Value)%> </td>
          </tr>
          <tr class="skin-info1">
            <td width="24%" align="default">提请验收时间</td>
            <td width="76%" align="default"><%=(rslist.Fields.Item("提请验收时间").Value)%> </td>
          </tr>
          <tr class="skin-info2">
            <td align="default">验收结果</td>
            <td align="default"><%=(rslist.Fields.Item("验收结果").Value)%></td>
          </tr>
          <tr class="skin-info2">
            <td width="24%" align="default">验收人              </td>
            <td width="76%" align="default">            <%=(rslist.Fields.Item("验收人").Value)%>            </td>
          </tr>
          <tr class="skin-info2">
            <td width="24%" align="default">验收单位</td>
            <td width="76%" align="default"><%=(rslist.Fields.Item("验收单位").Value)%> </td>
          </tr>
          <tr class="skin-info2">
            <td align="default">验收确认人</td>
            <td align="default"><%= Session("MM_Username") %></td>
          </tr>
          <tr class="skin-info2">
            <td align="default">验收时间</td>
            <td align="default"><%=(rslist.Fields.Item("验收时间").Value)%></td>
          </tr>
          <tr class="skin-info1">
            <td align="default">
            <div align="left">审核结果              </div></td>
            <td align="default"><table width="322">
              <tr>
                <td width="137"><label>
                  <input name="审核结果" type="radio" value="及时消缺" checked>
                  及时消缺</label></td>
                <td width="140"><label>
                  <input type="radio" name="审核结果" value="同意合并处理">
同意合并处理
                  </label></td>
              </tr>
              <tr>
                <td><label>
                      <input type="radio" name="审核结果" value="同意停机处理">
                      同意停机处理
                  </label></td>
                <td><label>
                       <input type="radio" name="审核结果" value="纳入小修计划">
                       纳入小修计划 </label></td>
              </tr>
              <tr>
                <td><label>
                  <input type="radio" name="审核结果" value="考核检修部门">
                  考核检修部门</label></td>
                <td>
                 <input type="radio" name="审核结果" value="考核运行部门">
                  考核运行部门</td>
                  
              </tr>
              <tr>
                 <td width="67">
                 <input type="radio" name="审核结果" value="其他">
                  其他</td>

              </tr>
            </table></td>
          </tr>
          <tr class="skin-info1">
            <td align="default">审核备注</td>
            <td align="default"><textarea name="审核备注" cols="40" rows="3" id="审核备注">无备注</textarea></td>
          </tr>
          <tr class="skin-info1">
            <td align="default">审核人</td>
            <td align="default">            <%= Session("MM_Username") %>
            <input name="审核时间" type="hidden" id="审核时间2" value="<%=now() %>">
            <input name="审核人" type="hidden" id="审核人2" value="<%= Session("MM_Username") %>"></td>
          </tr>
          <tr class="skin-info1">
            <td align="default">审核单位</td>
            <td align="default"><select name="审核单位" id="审核单位">
              <%
While (NOT Recordset2.EOF)
%>
              <option value="<%=(Recordset2.Fields.Item("审核单位").Value)%>" <%If (Not isNull((Recordset2.Fields.Item("审核单位").Value))) Then If (CStr(Recordset2.Fields.Item("审核单位").Value) = CStr((Recordset2.Fields.Item("审核单位").Value))) Then Response.Write("SELECTED") : Response.Write("")%> ><%=(Recordset2.Fields.Item("审核单位").Value)%></option>
              <%
  Recordset2.MoveNext()
Wend
If (Recordset2.CursorType > 0) Then
  Recordset2.MoveFirst
Else
  Recordset2.Requery
End If
%>
            </select>
            <input name="状态" type="hidden" id="状态3" value="9">            </td>
          </tr>
        </table>
      </td>
    </tr>
    <tr>
      <td height="37" colspan="2" align="default"> <div align="center">
        <input name="审核" type="submit" class="button" id="审核2" value="提交审核">
      </div></td>
    </tr>
    <tr>
      <td height="37" colspan="2" align="default"> <div align="center">
        <font color="#FF6600"><a href="javascript:history.go( -1 );" class="color-orange">返回</a></font> </div></td>
    </tr>
  </table>
  <input type="hidden" name="MM_update" value="form1">
  <input type="hidden" name="MM_recordId" value="<%= rslist.Fields.Item("ID1").Value %>">
</form>
</body>
</html>
<%
rslist.Close()
Set rslist = Nothing
%>
<%
Recordset2.Close()
Set Recordset2 = Nothing
%>
<%
Recordset1.Close()
Set Recordset1 = Nothing
%>
<!--#include file="copyright.asp" -->
搜索更多相关主题的帖子: 运行 ASP 
2009-12-24 11:22
风大陆
Rank: 1
等 级:新手上路
帖 子:3
专家分:0
注 册:2009-12-24
收藏
得分:0 
这是我从别人那拷的程序,为什么我增加了一个其他在审核结果中,但这个其他就是没用,不能更新数据库,但其他的审核结果,即原来程序中有的却可以更新数据库:
就是这段:
 <div align="left">审核结果              </div></td>
            <td align="default"><table width="322">
              <tr>
                <td width="137"><label>
                  <input name="审核结果" type="radio" value="及时消缺" checked>
                  及时消缺</label></td>
                <td width="140"><label>
                  <input type="radio" name="审核结果" value="同意合并处理">
同意合并处理
                  </label></td>
              </tr>
              <tr>
                <td><label>
                      <input type="radio" name="审核结果" value="同意停机处理">
                      同意停机处理
                  </label></td>
                <td><label>
                       <input type="radio" name="审核结果" value="纳入小修计划">
                       纳入小修计划 </label></td>
              </tr>
              <tr>
                <td><label>
                  <input type="radio" name="审核结果" value="考核检修部门">
                  考核检修部门</label></td>
                <td>
                 <input type="radio" name="审核结果" value="考核运行部门">
                  考核运行部门</td>
                  
              </tr>
              <tr>
                 <td width="67">
                 <input type="radio" name="审核结果" value="其他">
                  其他</td>

              </tr>
2009-12-24 11:24
孤独冷雨
Rank: 10Rank: 10Rank: 10
来 自:安徽滁州
等 级:贵宾
威 望:23
帖 子:1247
专家分:1909
注 册:2007-6-4
收藏
得分:20 
去杀你们老师吧。这个孙子又在祸害你们学生了。用DW生成代码做东西!该杀!

把更新数据的代码贴出来,帮你看一下!

[ 本帖最后由 孤独冷雨 于 2009-12-24 11:42 编辑 ]

这里有男女系列成人用品,有时间兄弟们来看一看.
51za.
2009-12-24 11:25
风大陆
Rank: 1
等 级:新手上路
帖 子:3
专家分:0
注 册:2009-12-24
收藏
得分:0 
那你能帮我看一下,为什么我增加了个其他就不能审核通过,但程序中原有的却可以
2009-12-24 11:27
快速回复:我在ASP程序中增加内容,为什么不运行
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.027781 second(s), 9 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved