以下代码使用相同数据库,相同连接串,不同表,出现500错误!
通过代码:
<%
Set upLoad = New upload_5xSoft
author = upload.form("author") '//其它元素
content = upload.form("content") '//其它元素
linkurl = upload.form("linkurl")
Set file=upLoad.file("upfile") '//file元素
If file.FileSize>0 Then
sFileName = CStr(file.FileName)
' sFileName= sFileName & right(file.FileName,LEN(Trim(file.FileName)))
' sFileName= sFileName & right(file.FileName,20)
' sFileName=sFileName & Trim(file.FileName)
file.SaveAs Server.mappath(sPath&sFileName)
Response.Write author
Response.Write "
"&linkurl&""
Response.Write content&"
"
Response.Write "
"
Response.Write "上传成功!"
ELSE
Response.Write "上传不成功!"
End If
Set file = Nothing
'将提交的内容存入数据库
'-------------------------------------------
set rs = Server.CreateObject("ADODB.Recordset")
rs.Open "upfile", conn, 1, 3
rs.AddNew
rs("author") = author
rs("content") = content
rs("linkurl") = linkurl
rs("FileName") = sFileName
rs("uptime") = now
rs.Update
Rs.Close
Conn.Close
Set Rs=Nothing
Set Conn=Nothing
Response.Write "
恭喜您!您已经将资料存入数据库!"
'------------------------------------------------------------
%>
未通过代码:
<%
Set upLoad = New upload_5xSoft
username = upload.form("username")
netID = upload.form("netID")
job = upload.form("job")
QQ = upload.form("QQ")
MSN = upload.form("MSN")
sFileName = CStr(file.FileName)
'将提交的内容存入数据库
'-------------------------------------------
If Username = "" Or NetID = "" Or job = "" Or QQ = "" Or MSN = "" Then
response.write ""
Response.End
ElseIf Instr(MSN, "@") = 0 Or Right(MSN, 1) = "@" Or Left(MSN, 1) = "@" Then
response.write ""
Response.End
End If
sql = "Select * From mp Where QQ = '"&QQ&"'"
set rs = conn.Execute(sql)
If Not rs.EOF Then
response.write ""
Response.End
End If
set rs = Server.CreateObject("ADODB.Recordset")
rs.Open "mp", conn, 1, 3
rs.AddNew
rs("username") = username
rs("netID") = netID
rs("job") = job
rs("QQ") = QQ
rs("MSN") = MSN
rs("FileName") = sFileName
rs("uptime") = now
rs.Update
Rs.Close
Conn.Close
Set Rs=Nothing
Set Conn=Nothing
'--------------------------------------------------------------
'将文件存入目录
Set file=upLoad.file("upfile")
If file.FileSize>0 Then
' sFileName= sFileName & right(file.FileName,LEN(Trim(file.FileName)))
' sFileName= sFileName & right(file.FileName,20)
' sFileName=sFileName & Trim(file.FileName)
file.SaveAs Server.mappath(sPath&sFileName)
End If
Set file = Nothing
'---------------------------------------------------------------------------
Response.Write "
恭喜您!您已经将资料存入数据库!"
'------------------------------------------------------------
%>