主题:  关于Dreamweaver MX 问题

cnhawk386

职务:普通成员
等级:1
金币:0.0
发贴:38
#12005/8/7 16:27:55
留言板Dreamweaver MX 中代码如下:
<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<!--#include file="Connections/manage.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 & "?" & 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") = "liuyan" Then

MM_editConnection = MM_manage_STRING
MM_editTable = "liuyan"
MM_editRedirectUrl = "successly.asp"
MM_fieldsStr = "textfield|value|textfield2|value|textfield3|value|textfield
4|value|textfield5|value|textarea|value"
MM_columnsStr = "name|',none,''|nickname|',none,''|trade|',none,''|position|
',none,''|e-mail|',none,''|demand|',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.Query
String <> "" 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 & " va
lues (" & 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
%>
<html><!-- InstanceBegin template="/Templates/mob1.dwt.asp" codeOutsideHTMLIsL
ocked="false" -->
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<!-- InstanceBeginEditable name="doctitle" -->
<title>管理资料库</title>
<!-- InstanceEndEditable -->
<!-- InstanceBeginEditable name="head" -->
<!-- InstanceEndEditable -->
<style TYPE="text/css">
<!--
A:link{text-decoration:none}
A:visited{text-decoration:none}
A:hover {color: #ff00ff;text-decoration:underline}
-->
</style>

<style>
<!--
#glowtext{
filter:glow(color=blue,strength=2);
width:100%;
}
-->
</style>
<script language="javascript1.2">

function glowit(which){
if (document.all.glowtext[which].filters[0].strength==2)
document.all.glowtext[which].filters[0].strength=1
else
document.all.glowtext[which].filters[0].strength=2
}

function glowit2(which){
if (document.all.glowtext.filters[0].strength==2)
document.all.glowtext.filters[0].strength=1
else
document.all.glowtext.filters[0].strength=2
}

function startglowing(){
if (document.all.glowtext&&glowtext.length){
for (i=0;i<glowtext.length;i++)
eval('setInterval("glowit('+i+')",150)')
}
else if (glowtext)
setInterval("glowit2(0)",150)
}

if (document.all)
window.onload=startglowing
</script>
<script language=javascript>
<!--
// ------ 定义全局变量
var theNewsNum;
var theAddNum;
var totalNum;
var CurrentPosion=0;
var theCurrentNews;
var theCurrentLength;
var theNewsText;
var theTargetLink;
var theCharacterTimeout;
var theNewsTimeout;
var theBrowserVersion;
var theWidgetOne;
var theWidgetTwo;
var theSpaceFiller;
var theLeadString;
var theNewsState;
function startTicker()
{
// ------ 设置初始数值
theCharacterTimeout = 50;//字符间隔时间
theNewsTimeout = 2000;//新闻间隔时间
theWidgetOne = "_";//新闻前面下标符1
theWidgetTwo = "-";//新闻前面下标符
theNewsState = 1;
//theNewsNum = document.body.children.incoming.children.NewsN
um.innerText;//新闻总条数
//add by lin
theNewsNum = document.getElementById("incoming".children.AllNews.
children.length;//新闻总条数
theAddNum = document.getElementById("incoming".children.AddNews.c
hildren.length;//补充条数
totalNum =theNewsNum+theAddNum;
theCurrentNews = 0;
theCurrentLength = 0;
theLeadString = " ";
theSpaceFiller = " ";
runTheTicker();
}
// --- 基础函数
function runTheTicker()
{
if(theNewsState == 1)
{
if(CurrentPosion<theNewsNum){
setupNextNews();
}
else{
setupAddNews();
}
CurrentPosion++;
if(CurrentPosion>=totalNum||CurrentPosion>=5) CurrentPosion=0; //最多条
数不超过5条
}
if(theCurrentLength != theNewsText.length)
{
drawNews();
}
else
{
closeOutNews();
}
}
//more javascript from www.webjx.com
// --- 跳转下一条新闻
function setupNextNews()
{
theNewsState = 0;
theCurrentNews = theCurrentNews % theNewsNum;
theNewsText = document.getElementById("AllNews".children[theCurrent
News].children.Summary.innerText;
theTargetLink = document.getElementById("AllNews".children[theCurre
ntNews].children.NewsLink.innerText;
theCurrentLength = 0;
document.all.hottext.href = theTargetLink;
theCurrentNews++;
}
function setupAddNews()
{
theNewsState = 0;
theCurrentNews = theCurrentNews % theAddNum;
theNewsText = document.getElementById("incoming".children.AddNews.c
hildren[theCurrentNews].children.Summary.innerText;
theTargetLink = document.getElementById("incoming".children.AddNews
.children[theCurrentNews].children.NewsLink.innerText;
theCurrentLength = 0;
document.all.hottext.href = theTargetLink;
theCurrentNews++;
}
// --- 滚动新闻
function drawNews()
{
var myWidget;
if((theCurrentLength % 2) == 1)
{
myWidget = theWidgetOne;
}
else
{
myWidget = theWidgetTwo;
}
document.all.hottext.innerHTML = theLeadString + theNewsText.substri
ng(0,theCurrentLength) + myWidget + theSpaceFiller;
theCurrentLength++;
setTimeout("runTheTicker()", theCharacterTimeout);
}
// --- 结束新闻循环
function closeOutNews()
{
document.all.hottext.innerHTML = theLeadString + theNewsText + theSp
aceFiller;
theNewsState = 1;
setTimeout("runTheTicker()", theNewsTimeout);
}
window.onload=startTicker;
//-->
</script>

</head>

<body>
<table width="767" height="76" border="0">
<tr>
<td width="61"> <p align="center"><span id="glowtext">管理</span>
</p></td>
<td width="619" rowspan="3" background="pict/tu1.jpg">&nbsp;</td>
<td width="65" height="20"> <div align="center">首页</div></td>
</tr>
<tr>

<td width="61"><div align="center"><span id="glowtext">资料库</span></div>
</td>
<td height="20"> <div align="center">留言本</div></td>
</tr>
<tr>
<td width="61">&nbsp;</td>
<td height="20"> <div align="center">联系我们</div></td>
</tr>
</table>
<p>
<script>

//下面设置显示效果的属性
var message="欢迎光临管理资料库!"
var neonbasecolor="blue"
var neontextcolor="33ff33"
var flashspeed=100 //in milliseconds

///No need to edit below this line/////

var n=0
if (document.all){
document.write('<font color="'+neonbasecolor+'">')
for (m=0;m<message.length;m++)
document.write('<span id="neonlight">'+message.charAt(m)+'</span>')
document.write('</font>')

//cache reference to neonlight array
var tempref=document.all.neonlight
}
else
document.write(message)

function neon(){

//Change all letters to base color
if (n==0){
for (m=0;m<message.length;m++)
tempref[m].style.color=neonbasecolor
}

//cycle through and change individual letters to neon color
tempref[n].style.color=neontextcolor

if (n<tempref.length-1)
n++
else{
n=0
clearInterval(flashing)
setTimeout("beginneon()",1500)
return
}
}

function beginneon(){
if (document.all)
flashing=setInterval("neon()",flashspeed)
}
beginneon()


</script>
</p>
<table>
<tr><td>
<div id=visible>本站告示:<a href="" id=hottext target="_blank"></a></di
v>
</td></tr>
</table>
<div id=incoming style="DISPLAY: none">
<div id=AllNews>
<div id=1>
<div id=Summary>本站整合大量策划材料、调研报告、企业管理咨询的相关资料,
调研报告</div>
<div id=NewsLink>#</div>
</div>
<div id=2>
<div id=Summary>采自国际标准的世界500强企业以及中国知名企业真实项目,请购
买后不要肆意传播</div>
<div id=NewsLink>#</div>
</div>
<div id=3>
<div id=Summary>企业管理资料均采自顶级咨询公司的内部材料</div>
<div id=NewsLink>#</div>
</div>
<div id=4>
<div id=Summary>如果侵犯贵公司的权益请及时与我们联系,我们将在24小时内删
除正在使用的资料</div>
<div id=NewsLink>#</div>
</div>
</div>

<div id=AddNews>
</div>
</div>
</div>
<!-- InstanceBeginEditable name="caid" -->
<table width="769" border="0">
<tr>
<td>
<p align="center"><font size="7">留言板</font></p>
</td>
</tr>
</table>
<!-- InstanceEndEditable --> <!-- InstanceBeginEditable name="article" -->
<form action="<%=MM_editAction%>" method="POST" name="liuyan" id="liuyan">
<table width="769" height="209" border="1">
<tr>
<td width="191">&nbsp;</td>
<td width="365"> <input type="text" name="textfield"></td>
<td width="191">&nbsp;</td>
</tr>
<tr>
<td>&nbsp;</td>
<td> <input type="text" name="textfield2"></td>
<td>&nbsp;</td>
</tr>
<tr>
<td>&nbsp;</td>
<td> <input type="text" name="textfield3"></td>
<td>&nbsp;</td>
</tr>
<tr>
<td>&nbsp;</td>
<td> <input type="text" name="textfield4"></td>
<td>&nbsp;</td>
</tr>
<tr>
<td>&nbsp;</td>
<td> <input type="text" name="textfield5"></td>
<td>&nbsp;</td>
</tr>
<tr>
<td>&nbsp;</td>
<td> <textarea name="textarea"></textarea></td>
<td>&nbsp;</td>
</tr>
</table>
<table width="75%" border="1">
<tr>
<td><input type="submit" name="Submit" value="提交"></td>
<td><input type="reset" name="Submit2" value="重置"></td>
</tr>
</table>
<p>&nbsp;</p>
<input type="hidden" name="MM_insert" value="liuyan">
</form>
<!-- InstanceEndEditable -->
<hr>
<div align="center">
<p><font color="#0000FF">管理资料库版权所有</font> </p>
<p>&nbsp; </p>
<p>&nbsp;</p>
<p>&nbsp;</p><p>&nbsp;</p>
<h2>&nbsp; </h2>
</body>
<!-- InstanceEnd --></html>
当在执行后,输入相关数据按提交按纽后,错误提示如下:
Microsoft OLE DB Provider for ODBC Drivers 错误 '80040e14'

[Microsoft][ODBC Microsoft Access 驱动程序] INSERT INTO 语句的语法错误。

/TMPgaowkpni4.asp, 行115
哪位同学老师知道怎么回事,谢谢



蓝鲸

职务:版主
等级:5
金币:42.1
发贴:2614
#22005/8/8 8:59:28
指出出错代码区的代码,
用Dreamwaver做,代码可读性太差了


非常大鱼

缺缺

职务:管理员
等级:8
金币:41.0
发贴:9620
#32005/8/8 9:25:53
将所有的字段名加上[]先~



六月人

职务:普通成员
等级:1
金币:0.0
发贴:3
#42005/9/7 12:29:41
最後怎麽解決的?



布鲁斯狼

职务:普通成员
等级:2
金币:11.0
发贴:377
#52005/9/9 17:31:55
最好做表单检查,很多是因为你的数据类型不吻合



绿茶

职务:普通成员
等级:8
金币:10.0
发贴:19267
#62005/9/17 17:16:44
千万不要使用MX生成的代码,可维护性太差了