注册 登录
编程论坛 ASP技术论坛

为何无法写入数据库?请高手教我!

sundeben 发布于 2010-12-09 15:08, 839 次点击
  文件上传没有问题,但是我想把几个变量的值写入数据库,没有成功,不知问题出在哪里,请高手赐教!
<%@LANGUAGE="VBSCRIPT"%>
<!--#include file="Connections/connebwz.asp" -->

<!--#include file="UpLoad_Class.vbs.asp" -->



<%
dim upload
set upload = new AnUpLoad
'upload.Exe = "jpg|bmp|jpeg|gif|png"
'upload.MaxSize = 2 * 1024 * 1024 '2M
upload.GetData()
if upload.ErrorID>0 then
    response.Write upload.Description
else
    lmxxid_p=upload.forms("select")
    filename=upload.forms("text1")
    response.Write(lmxxid_p)& "<br />"
        
    response.Write "文件名:" &(filename)& "<br />"
   
    dim file,savpath
    savepath = "rj"
    set file = upload.files("file1")
    if not(file is nothing) then
        if file.saveToFile(savepath,1,true) then
        rjurl=savepath& "/" & file.LocalName

        response.Write(rjurl)& "<br />"
            response.Write "文件'" & file.LocalName & "'上传成功,保存位置'" & server.MapPath(savepath & "/" & file.filename) & "',文件大小" & file.size & "字节"
        else
            response.Write file.Exception
        end if
    end if
end if



set upload = nothing


%>
<%
Dim rjtj
Dim rjtj_numRows
Set rjtj = Server.CreateObject("ADODB.Recordset")
rjtj.ActiveConnection = MM_connebwz_STRING
rjtj.Source = "SELECT * FROM rjxx ORDER BY rjxxid DESC"
rjtj.CursorType = 0
rjtj.CursorLocation = 2
rjtj.LockType = 3
rjtj.Open()
rjtj.addnew
rjtj.("rjxx_lmmcid")=lmxxid_p
rjtj.("rjname")=file.LocalName
rjtj.("rjlx")=filename
rjtj.("rjurl")=rjurl
rjtj.update

rjtj_numRows = 0
%>
<%
rjtj.Close()
Set rjtj = Nothing
%>
6 回复
#2
yms1232010-12-09 16:48
Access还是SQL Server数据库?
#3
zhanxinlin2010-12-09 23:33
分区是不是NTFS或者数据库只读。
#4
sundeben2010-12-10 08:28
数据库是Access,数据库读写没有问题.权限已是完全控制
#5
sundeben2010-12-10 08:29
我是想知道代码是否有问题?
#6
aspic2010-12-10 17:29
upload.forms
#7
sundeben2010-12-11 14:34
可否再说详细一些,十分感谢!
1