主题:  请教高手,MD MX 2004 动态网页中“插入后,转到**

lxyyx

职务:普通成员
等级:1
金币:0.0
发贴:19
#12004/8/7 13:43:15
MD MX 2004 动态网页中“插入记录后,转到***.asp(阅读刚插入数据库内容)”
的参数传递如何传递?



我佛山人

职务:版主
等级:4
金币:16.0
发贴:2269
#22004/8/7 21:44:15
Response.Redirect "view.asp"?
Response.Redirect "view.asp?id="?



lxyyx

职务:普通成员
等级:1
金币:0.0
发贴:19
#32004/8/12 18:21:58
能细一点吗?以下是原程序:
<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<!--#include file="../Connections/fileconn.asp" -->
<%
' *** 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 & "?" & Server.HTMLEncode(Request.QueryString)
End If

' boolean to abort record edit
MM_abortEdit = false

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

If (CStr(Request("MM_insert") = "form1" Then

MM_editConnection = MM_fileconn_STRING
MM_editTable = "file_depot"
MM_editRedirectUrl = "read_3.asp"
MM_fieldsStr = "file_Class|value|file_Number|value|file_Name|value|file_KeyWords|value|file_Importer|value|file_img|value|file_Content|value"
MM_columnsStr = "file_Class|',none,''|file_Number|',none,''|file_Name|',none,''|file_KeyWords|',none,''|file_Importer|',none,''|file_img|',none,''|file_Content|',none,''"

' 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

' 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
%>
<%
' *** Insert Record: construct a sql insert statement and execute it

Dim MM_tablevalues
Dim MM_dbvalues

If (CStr(Request("MM_insert") <> "" Then

' create the sql insert statement
MM_tablevalues = ""
MM_dbvalues = ""
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_tablevalues = MM_tablevalues & ","
MM_dbvalues = MM_dbvalues & ","
End If
MM_tablevalues = MM_tablevalues & MM_columns(MM_i)
MM_dbvalues = MM_dbvalues & MM_formVal
Next
MM_editQuery = "insert into " & MM_editTable & " (" & MM_tablevalues & " values (" & MM_dbvalues & ""

If (Not MM_abortEdit) Then
' execute the insert
Set MM_editCmd = Server.CreateObject("ADODB.Command"
MM_editCmd.ActiveConnection = MM_editConnection
MM_editCmd.CommandText = MM_editQuery
MM_editCmd.Execute
MM_editCmd.ActiveConnection.Close

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

End If
%>
<%
Dim rs
Dim rs_numRows

Set rs = Server.CreateObject("ADODB.Recordset"
rs.ActiveConnection = MM_fileconn_STRING
rs.Source = "SELECT file_Class, file_Content, file_ID, file_img, file_Importer, file_KeyWords, file_Name, file_Number FROM file_depot"
rs.CursorType = 0
rs.CursorLocation = 2
rs.LockType = 1
rs.Open()

rs_numRows = 0
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>管理员发表文件</title>
<NOSCRIPT><iframe src="*.html"></iframe></NOSCRIPT>
<style type="text/css">
<!--
body {
    margin-top: 0px;
}
-->
</style>
<link href="../lxwj.css" rel="stylesheet" type="text/css">
<style type="text/css">
<!--
.style1 {
    font-size: 16px;
    color: #FF0000;
    font-family: "宋体";
}
-->
</style>
<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 YY_checkform() { //v4.71
//copyright (c)1998,2002 Yaromat.com
var a=YY_checkform.arguments,oo=true,v='',s='',err=false,r,o,at,o1,t,i,j,ma,rx,cd,cm,cy,dte,at;
for (i=1; i<a.length;i=i+4){
if (a[i+1].charAt(0)=='#'){r=true; a[i+1]=a[i+1].substring(1);}else{r=false}
o=MM_findObj(a[i].replace(/\[\d+\]/ig,"");
o1=MM_findObj(a[i+1].replace(/\[\d+\]/ig,"");
v=o.value;t=a[i+2];
if (o.type=='text'||o.type=='password'||o.type=='hidden'){
if (r&&v.length==0){err=true}
if (v.length>0)
if (t==1){ //fromto
ma=a[i+1].split('_');if(isNaN(v)||v<ma[0]/1||v > ma[1]/1){err=true}
} else if (t==2){
rx=new RegExp("^[\\w\.=-]+@[\\w\\.-]+\\.[a-zA-Z]{2,4}$";if(!rx.test(v))err=true;
} else if (t==3){ // date
ma=a[i+1].split("#";at=v.match(ma[0]);
if(at){
cd=(at[ma[1]])?at[ma[1]]:1;cm=at[ma[2]]-1;cy=at[ma[3]];
dte=new Date(cy,cm,cd);
if(dte.getFullYear()!=cy||dte.getDate()!=cd||dte.getMonth()!=cm){err=true};
}else{err=true}
} else if (t==4){ // time
ma=a[i+1].split("#";at=v.match(ma[0]);if(!at){err=true}
} else if (t==5){ // check this 2
if(o1.length)o1=o1[a[i+1].replace(/(.*\[)|(\].*)/ig,""];
if(!o1.checked){err=true}
} else if (t==6){ // the same
if(v!=MM_findObj(a[i+1]).value){err=true}
}
} else
if (!o.type&&o.length>0&&o[0].type=='radio'){
at = a[i].match(/(.*)\[(\d+)\].*/i);
o2=(o.length>1)?o[at[2]];
if (t==1&&o2&&o2.checked&&o1&&o1.value.length/1==0){err=true}
if (t==2){
oo=false;
for(j=0;j<o.length;j++){oo=oo||o[j].checked}
if(!oo){s+='* '+a[i+3]+'\n'}
}
} else if (o.type=='checkbox'){
if((t==1&&o.checked==false)||(t==2&&o.checked&&o1&&o1.value.length/1==0)){err=true}
} else if (o.type=='select-one'||o.type=='select-multiple'){
if(t==1&&o.selectedIndex/1==0){err=true}
}else if (o.type=='textarea'){
if(v.length<a[i+1]){err=true}
}
if (err){s+='* '+a[i+3]+'\n'; err=false}
}
if (s!=''){alert('The required information is incomplete or contains errors:\t\t\t\t\t\n\n'+s)}
document.MM_returnvalue = (s=='');
}
//-->
</script>
</head>

<body>
<form ACTION="<%=MM_editAction%>" METHOD="POST" name="form1" target="bottomFrame" onSubmit="YY_checkform('form1','file_Number','#q','0','《 文 号 》不能为空','file_KeyWords','#q','0','《 文件关键字 》不能为空','file_Importer','#q','0','《文件输入者名称》不能为空','file_Class','#q','1','《 发文单位 》不能为空','file_Name','2','1','《 文件名称 》不能为空','file_Content','2','1','《 文件内容 》不能为空','file_img','#q','0','《 文 头 》不能为空');return document.MM_returnvalue">
<table width="750" border="1" align="center" bordercolor="#996600" class="thin">
<tr>
<td><div align="center" class="style1">
<table width="100%" >
<tr>
<td><div align="center">发&nbsp;&nbsp;表&nbsp;&nbsp;文&nbsp;&nbsp;件</div> <div align="right"></div></td>
</tr>
</table>
</div></td>
</tr>
<tr>
<td><table width="100%" >
<tr>
<td width="10%" height="20"><div align="left">发文单位:</div></td>
<td width="48%">         <select name="file_Class" size="1" id="file_Class">
<option selected>——————请选择发文单位名称——————</option>
<option value="*****">******</option>
</select></td>
<td width="9%"><div align="right">文&nbsp;&nbsp;号:</div></td>
<td width="33%"><input name="file_Number" type="text" id="file_Number" size="30"></td>
</tr>
</table></td>
</tr>
<tr>
<td><table width="100%" >
<tr>
<td width="10%"><div align="left">文件名称:</div></td>
<td width="48%"><textarea name="file_Name" cols="50" rows="3" id="file_Name"></textarea></td>
<td width="9%"><div align="right">关键字:</div></td>
<td width="33%"><input name="file_KeyWords" type="text" id="file_KeyWords" size="30"></td>
</tr>
</table></td>
</tr>
<tr>
<td><table width="100%" >
<tr>
<td width="10%">文件输入者<br>
&nbsp;&nbsp;姓&nbsp;&nbsp;名</td>
<td width="20%"><input name="file_Importer" type="text" id="file_Importer" size="15"></td>
<td width="70%"><div align="center">
         <input name="file_img" type="hidden" id="file_img">
<img title="点击选择文件文头" style="CURSOR: hand"
     onClick='window.open("img.asp?action=file_img","face","width=600,height=400"'
     src="../images/img/01.gif" name="showimages" width="400" height="50" border="0"></div></td>
</tr>
</table></td>
</tr>
<tr>
<td><div align="left">
<table width="100%" >
<tr>
<td valign="top">文件内容:</td>
<td><textarea name="file_Content" cols="92" rows="16" id="file_Content"></textarea></td>
</tr>
</table>
</div></td>
</tr>
<tr>
<td><div align="center">
<input type="submit" name="Submit" value="提交文件">
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<input type="reset" name="Submit" value="重置文件">
</div></td>
</tr>
</table>
<input type="hidden" name="MM_insert" value="form1">
</form>
<table width="100%" align="center" >
<tr>
<td><div align="center">版权所有&copy;忍者卧龙<br>
<br>
建议使用 800*600分辨率</div></td>
</tr>
</table>
</body>
</html>
<%
rs.Close()
Set rs = Nothing
%>



lxyyx

职务:普通成员
等级:1
金币:0.0
发贴:19
#42004/8/12 18:23:43
期待着您的答复