【asp】这段ASP程序为什么插不入了数据库呢?

来源:百度知道 编辑:UC知道 时间:2024/07/13 05:08:56
<!--#include file="Inc/config.asp"-->
<!--#include file="Inc/upload.asp"-->
<!--#include file="Inc/conn.asp"-->
<%
const upload_type=0

dim upload,file,formName,SavePath,filename,fileExt
dim upNum
dim EnableUpload
dim Forumupload
dim ranNum
dim uploadfiletype
dim msg,founderr
msg=""
founderr=false
EnableUpload=false
SavePath = "upfile"
if right(SavePath,1)<>"/" then SavePath=SavePath&"/"
%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
</head>
<body>
<%
if EnableUploadFile="No" then
response.write "系统未开放文件上传功能"
else
if session("name")="" then
response.Write("请登录后再使用本功能!")
else
select cas

注意看这段:
sql="select * from ms_user where userid="&request("user_id")&""
if rs.eof=false then
rs("photo")=filename
rs.update
end if
set rs=nothing
rs.close()

定义了sql,但是没是使用啊,应该是少了这句:
rs.open sql,conn,1,3
但是,你这段里也没有conn啊,那就要看你conn.asp页面中用的是不是conn了。
你学asp多长时间了,这种问题稍微一入门的人都应该能看出来的,如果不懂在asp中使用ado操作数据库的话,建议还是补一下,其实很简单的,一共就查看、删除、添加、更新四种操作,当然如果想学的深一些的话,就涉及到存储过程触发器那些了。

你先输出要保存的路径看看有没有,要是有的话,看看写入数据语句对不对

上面那位好好先生说得对哟.

在这两句之间加入一句:rs.open sql,conn,1,3

sql="select * from ms_user where
userid="&request("user_id")&""
rs.open sql,conn,1,3(在此加入)

if rs.eof=false then

试试看