两个页面
index
<%@LANGUAGE="JAVASCRIPT" CODEPAGE="936"%>
<%
//提供上传提示消息,供DHTML使用
var msg = Request.QueryString("msg");
if(!isNaN(msg))
{
if(msg==0)
msg = "上传成功!";
if(msg==1)
msg = "上传文件类型错误!";
if(msg==2)
msg = "上传文件大小超过限制!";
}
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>无标题文档 </title>
</head>
<body>
<form method="post" action="UploadMethod.asp" enctype="multipart/form-data">
<label>
<input type="file" name="file1" /> <span id="MyMSG"> </span>
</label>
<p>工程名称:
<input name="gongchengmingcheng" type="text" />
</p>
<p>工程简介:
<textarea name="gongchengjianjie" cols="" rows="5"> </textarea>
</p>
<p> <input name="submit" type="submit" onclick="return MyMSGText();" value="Submit"/>
</p>
</form>
<script language="JavaScript" type="text/javascript">
<!--
var msg = " <%= msg %>";
MyMSG.innerText = msg;
MyMSG.style.color = "red";
function MyMSGText()
{
MyMSG.innerText = "正在上传!";
}
//-->
</script>
</body>
</html>
接收页面
<!--#include file="MyJSUploadClass.asp" -->
<%
var MyType = "jpg|gif|rar|doc";
var MyLength = 100;
var FileName = "img/gongcheng/"+(new Date()).getTime();
var MMC = new MyMainClass(MyType,MyLength,FileName);
var fileType = MMC.MyStart();
var maxid=0;
if(isNaN(fileType))
{
//数据库写入
Dim strConn,objDB,strSQL
strConn="DRIVER={Microsoft Access Driver (*.mdb)};DBQ="&server.MapPath("liuyan.mdb")
Set objDB=Server.CreateObject("ADODB.connection")
objDB.open strConn
strSQL=="insert into gongcheng (id,dizhi,biaoti,neirong) values (32,'rwer','23ewr','dasdasd')"
objDB.Execute(strSQL)
strConn.Close
Set strConn=Nothing
///////////
fileType = 0;
}
Response.Redirect("shangchuangongcheng.asp?msg=" + fileType);
%>
一直是错误,去掉数据库写入的就正常了,添加上就有错误,请高手帮忙解决一下吧!!!!
是不是数据库设置问题?
看来看去说实在的就只有你strSQL=="insert into gongcheng (id,dizhi,biaoti,neirong) values (32,'rwer','23ewr','dasdasd')" 这句话了,这个应该是strSQL=""而不是strSQL==""吧!只有一个=啦
修改后应该没问题吧
楼上说的很正确啊!
。。。。。。。。