|
|
#4
天空云朵2011-02-22 17:31
版主您好,感谢您的及时回答,祝愿本论坛越办越好!
按您的修正又经过本地测试,可还是出现同样问题。
为了您能看全代码,现将ProductEdit.asp 网页全部代码复制内容如下:请您指正,谢谢!
---------------------------------------------------------------------------------
<!-- #include file="../../Component/Class_Startup.asp" -->
<!-- #include file="../../Component/CheckLogin.asp" -->
<!-- #include file="../../Component/Ixinde_Upload.asp" -->
<!-- #include file="../Include/ConnectionString.inc" -->
<%
'======================================
'检查是否登录,或登录超时
'注意:一定要包含CheckLogin.asp组件
'======================================
Dim oLogin
Set oLogin = New Ixinde_CheckLogin
If Not oLogin.CheckLogin Then
Set oLogin = Nothing
Response.Write("<script>alert('登录已超时,请重新登录系统。');top.location.href='../Login.asp';</script>")
Response.End()
End If
Set oLogin = Nothing
'======================================
'======================================
'检查地址的有效性
'======================================
If Not SQLFormater() Then
Response.Write("<script>alert('无效地址.');</script>")
Response.End()
End If
'======================================
Dim sSQL, oRs, nCatID, nURL, nID, act,strSQL
Dim name
Dim Ename
Dim keyword
Dim province
Dim city
Dim star
Dim starNo
Dim price
Dim money
Dim address,liebiao
Dim imgSource
Dim pic1
Dim pic2
Dim pic3
Dim mappic
Dim intro
Dim telephone
Dim fax
Dim food
Dim entertainment
Dim service
Dim traffic
Dim OtherInfo
Dim Info
Dim SortIndex,strTitle,strKeywords,strDescription,strFileName
Dim IsNew
Dim IsSpecial
act = Request("act")
nID = Request.QueryString("ID")
nCatID = Request.QueryString("CatID")
If Not IsNumeric(nID) Then
nID = 0
End If
If Not IsNumeric(nCatID) Then
nCatID = 0
End If
If act = "" Then
act = "2"
End If
DBConnBegin(ConnectionString)
If Request.ServerVariables("REQUEST_METHOD") = "POST" Then
Dim oUpload
Set oUpload = New Ixinde_Upload
act = oUpload.Form("act")
nID = oUpload.Form("txtID")
nCatID = oUpload.Form("txtCatID")
nURL = oUpload.Form("txtURL")
Dim rsCatParent, nParentID, Description2
sSQL = "Select * From HotelCategory Where ID=" & nCatID
Set rsCatParent = oConn.Execute(sSQL)
If Not (rsCatParent.EOF And rsCatParent.BOF) Then
nParentID = rsCatParent("ParentID")
Description2 = rsCatParent("Description2")
End If
rsCatParent.Close()
Set rsCatParent = Nothing
If nID = 0 Then
nURl = "ProductView.asp?CatID="&nCatID&"&ParentID="&nParentID
End If
province = oUpload.Form("province")
city = oUpload.Form("city")
Name = oUpload.Form("Name")
Ename = oUpload.Form("Ename")
keyword = oUpload.Form("keyword")
starNo = oUpload.Form("starNo")
select case starNo
case 1
star = "一星"
case 2
star = "准二星"
case 3
star = "二星"
case 4
star = "准三星"
case 5
star = "三星"
case 6
star = "准四星"
case 7
star = "四星"
case 8
star = "准五星"
case 9
star = "五星"
end select
price = oUpload.Form("price")
money = oUpload.Form("money")
address = oUpload.Form("address")
liebiao = oUpload.Form("liebiao")
intro = oUpload.Form("intro")
telephone = oUpload.Form("telephone")
fax = oUpload.Form("fax")
food = oUpload.Form("food")
entertainment = oUpload.Form("entertainment")
service = oUpload.Form("service")
traffic = oUpload.Form("traffic")
OtherInfo = oUpload.Form("OtherInfo")
Info = oUpload.Form("Info")
IsSpecial = oUpload.Form("chkSpecial")
If IsSpecial = "" Then
IsSpecial = "0"
End If
IsNew = oUpload.Form("chkNew")
If IsNew = "" Then
IsNew = "0"
End If
SortIndex = oUpload.Form("txtSortIndex")
strTitle = oUpload.Form("txtTitle")
strKeywords = oUpload.Form("txtKeywords")
strDescription = oUpload.Form("txtDescription")
strFileName = oUpload.Form("txtFileName")
Dim formPath, formName, dtMonth
formPath = "..\UploadImage\" ''定义图片存放的路径,文件夹要先建好
dtMonth = Month(Now())
For Each formName In oUpload.Files
Dim oFile
Set oFile = oUpload.File(formName)
If oFile.FileSize > 0 Then
Dim file_exet, fileName
file_exet = Ucase(Mid(oFile.FileName, InStr(oFile.FileName, ".") + 1)) '获取扩展名
' If UCase(file_exet)="GIF" Or UCase(file_exet)="JPG" Or UCase(file_exet)="JPEG" Or UCase(file_exet)="ICO" Or UCase(file_exet)="bmp" Then
fileName = formPath & dtMonth & "\" & Year(Now()) & Month(Now()) & Day(Now()) & Hour(Now()) & Minute(Now()) & Second(Now()) & formName & "." & file_exet
oFile.SaveAs Server.MapPath(fileName)
select case LCase(formName)
case "txtpicturebig"
imgSource = fileName
case "pic1"
pic1 = fileName
case "pic2"
pic2 = fileName
case "pic3"
pic3 = fileName
case "mappic"
mappic = fileName
end select
'End If
End If
Set oFile = Nothing
Next
'Response.Write act & "<br>" & nID & "<br>" & nParentID & "<br>" & CatName & "<br>" & SortIndex & "<br>" & Icon
'Response.End()
Set oRs = Server.CreateObject("ADODB.Recordset")
sSQL = "Select * From Hotel Where ID=" & nID
oRs.ActiveConnection = ConnectionString
oRs.Source = sSQL
oRs.CursorType = 1
oRs.CursorLocation = 2
oRs.LockType = 3
oRs.Open
If nID=0 Then oRs.AddNew()
oRs("Name") = Name
oRs("EName") = EName
oRs("keyword") = keyword
oRs("province") = province
oRs("city") = city
oRs("star") = star
oRs("starNo") = starNo
If price <> "" Then
oRs("price") = price
End If
oRs("money") = money
oRs("address") = address
oRs("liebiao") = liebiao
' oRs("intro") = intro
oRs("telephone") = telephone
oRs("fax") = fax
' oRs("food") = food
' oRs("entertainment") = entertainment
oRs("service") = service
oRs("traffic") = traffic
oRs("OtherInfo") = OtherInfo
oRs("Info") = Info
If imgSource <> "" Then
oRs("imgSource") = imgSource
End If
If pic1 <> "" Then
oRs("pic1") = pic1
End If
If pic2 <> "" Then
oRs("pic2") = pic2
End If
If pic3 <> "" Then
oRs("pic3") = pic3
End If
If mappic <> "" Then
oRs("mappic") = mappic
End If
oRs("IsNew") = IsNew
oRs("IsSpecial") = IsSpecial
oRs("SortIndex") = SortIndex
oRs("keyTitle") = strTitle
oRs("keyKeywords") = strKeywords
oRs("keyDescription") = strDescription
oRs("fileName") = strFileName
oRs.Update() ---------这个是第249行出错的代码--------
oRs.Close()
If nID = 0 then
nID = oConn.Execute("Select * From Hotel order by ID desc")(0)
End If
' If nID=0 Then
' oRs.open "select top 1 ID from News order by ID desc",conn,1,1
' nID=oRs(0)
' oRs.close
' End if
oConn.Execute("Delete from Hotelfang where ParentID = " & nID)
Dim Tn ,ii
ii = oUpload.Form("Acount") - 1
For Tn = 1 To ii
If oUpload.Form("txtAnswer_"&Tn) <> "" Then
Set oRs = Server.CreateObject("ADODB.Recordset")
sSQL = "Select * From Hotelfang Where ID=0"
oRs.ActiveConnection = ConnectionString
oRs.Source = sSQL
oRs.CursorType = 1
oRs.CursorLocation = 2
oRs.LockType = 3
oRs.Open
oRs.AddNew()
oRs("ParentID") = nID
oRs("Answer") = oUpload.Form("txtAnswer_"&Tn&"")
oRs("price_can") = oUpload.Form("price_can_"&Tn&"")
oRs("price_te") = oUpload.Form("price_te_"&Tn&"")
oRs("content") = oUpload.Form("content_"&Tn&"")
oRs.Update()
oRs.Close()
End If
Next
set oUpload = Nothing
DBConnEnd()
Dim strRedirect,strSourceUrl
strRedirect="jiudian"
'strSourceUrl=request("sourceUrl") & ""
strSourceUrl="/jiudian/jiudian.asp?ID=" & nID'要生成的目标文件
strFileName=strFileName
'写入到文件
Write2file strRedirect,strSourceUrl,strFileName
'参数说明:strRedirect文件目录,strSourceUrl资源地址,strFileName文件名
'response.write strSourceUrl
'response.end
Response.Write("<script>location.href='"&nURL&"';alert('操作成功.');</script>")
response.end
End If
If nID = 0 Then
Name = ""
EName = ""
keyword = ""
sSQL = "Select * From HotelCategory Where IsDelete = 0 and ID=" & nCatID
Set rsCatParent = oConn.Execute(sSQL)
If Not (rsCatParent.EOF And rsCatParent.BOF) Then
nParentID = rsCatParent("ParentID")
If nParentID = 0 Then
province = rsCatParent("Name")
Else
province = oConn.Execute("Select name From HotelCategory Where IsDelete = 0 and ID=" & nParentID)(0)
city = rsCatParent("Name")
Description2 = rsCatParent("Description2")
If Description2 <> "" Then
city = city&"("&Description2&")"
End If
End If
End If
rsCatParent.Close()
Set rsCatParent = Nothing
starNo = 9
price = 0.00
money = "RM"
address = ""
liebiao = ""
imgSource = ""
pic1 = ""
pic2 = ""
pic3 = ""
mappic = ""
intro = ""
telephone = ""
fax = ""
food = ""
entertainment = ""
service = ""
traffic = ""
OtherInfo = ""
Info = ""
IsSpecial = 0
IsNew = 0
SortIndex = 0
Else
sSQL = "Select * From Hotel Where ID=" & nID
Set oRs = oConn.Execute(sSQL)
If (oRs.EOF And oRs.BOF) Then
Response.Write("<script>alert('没有找到指定记录,可能已经被删除。');history.back();</script>")
Response.End()
End If
Name = oRs("Name") & ""
EName = oRs("EName") & ""
keyword = oRs("keyword") & ""
province = oRs("province") & ""
city = oRs("city") & ""
star = oRs("star") & ""
starNo = oRs("starNo") & ""
price = oRs("price") & ""
money = oRs("money") & ""
address = oRs("address") & ""
liebiao = oRs("liebiao") & ""
imgSource = oRs("imgSource") & ""
pic1 = oRs("pic1") & ""
pic2 = oRs("pic2") & ""
pic3 = oRs("pic3") & ""
mappic = oRs("mappic") & ""
intro = oRs("intro") & ""
telephone = oRs("telephone") & ""
fax = oRs("fax") & ""
food = oRs("food") & ""
entertainment = oRs("entertainment") & ""
service = oRs("service") & ""
traffic = oRs("traffic") & ""
OtherInfo = oRs("OtherInfo") & ""
Info = oRs("Info") & ""
IsSpecial = oRs("IsSpecial")
IsNew = oRs("IsNew")
SortIndex = oRs("SortIndex")
strTitle = oRs("keyTitle")
strKeywords = oRs("keyKeywords")
strDescription = oRs("keyDescription")
strFileName = oRs("fileName")
End If
Dim rsLable
Dim iLable
strSQL="select parentID from hotelCategory where ID=" & nCatID
'response.write strSQL
Set rsLable = oConn.execute(strSQL)
If Not (rsLable.bof And rsLable.eof) Then
iLable=rsLable(0)
End if
Set rsLable = Nothing
If iLable=5 Or iLable="" Then
iLable=153
Else
iLable=154
End if
%>
<html>
<head>
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
|