|
|
|
Microsoft VBScript compilation error '800a0401' Expected end of statement |
|
|
|
|
|
|
|
Code (ASP)
<!--#INCLUDE FILE="./security.asp"-->
<!--#INCLUDE FILE="./globvar.asp"-->
<!--#INCLUDE FILE="./response.asp"-->
<%
Set conn = Server.CreateObject("ADODB.Connection")
conn.Open myDNS
set rs = server.createobject("ADODB.recordset")
Sub InsertItem(ID, ParentID, ItemID, ItemName, ItemDesc)
'Insert Data into Item Table
Field_insert = "ID, ParentID, SortCode, ItemID, ItemName, ItemDesc, [Type]"
Data_insert = ID & ", " & ParentID & ", 0, " & ItemID & ", " & ItemName & ", " & ItemDesc & _
", 'folder'"
SQLs = "INSERT INTO Item (" & Field_insert & ") VALUES (" & Data_insert & ")"
Response.Write vbCrLf & "<!--" & SQLs & "-->" &vbCrLf
conn.Execute(SQLs)
End Sub
'on error resume next
dim objUpload 'instance of Uplaod control
dim strMessage 'stores success/failure message sent back to main.asp
'create an instance of the Upload Control and trap for object creation failure
set objUpload = server.CreateObject("Dundas.Upload.2")
if err.number <> 0 then
response.Write "Have some error. Please try again."
response.End
end if
'don't use unique file names in the beginning
objUpload.UseUniqueNames = false
objUpload.UseVirtualDir = true
'upload data till first uploaded file is encountered
objUpload.SaveToMemory
FolderName = "../cgi-bin/images/"
ItemID = CharNull2DB(objUpload.Form("ItemID"))
ItemName = CharNull2DB(objUpload.Form("ItemName"))
ItemDesc = CharNull2DB(objUpload.Form("ItemDesc"))
act = objUpload.Form("act")
if act = "addnew" then
ParentID = objUpload.Form("ParentID")
ID = FindNewID("Item", "ID")
call InsertItem(ID, ParentID, ItemID, ItemName, ItemDesc)
elseif act = "update" then
id = objUpload.Form("id")
SQLs = "UPDATE Item SET" & _
" ItemID = " & ItemID & _
" , ItemName = " & ItemName & _
" , ItemDesc = " & ItemDesc & _
" WHERE ID = " & ID
Response.Write vbCrLf & "<!--" & SQLs & "-->" &vbCrLf
conn.Execute(SQLs)
else
response.End
end if
if act = "addnew" or act = "update" then
NewFileName1 = empty
NewFileName2 = empty
Set File1 = objUpload.Files("itempic")
Set File2 = objUpload.Files("itempic2")
if not(File1.OriginalPath = empty) then
NewFileName1 = right("000000"&id,6) & "_1" & right(CStr(File1.OriginalPath),4)
File1.SaveAs FolderName & NewFileName1
SQLs = "UPDATE Item SET" & _
" ItemPic = '" & NewFileName1 & "'" & _
" WHERE ID = " & ID
conn.Execute(SQLs)
end if
if not(File2.OriginalPath = empty) then
NewFileName2 = right("000000"&id,6) & "_2" & right(CStr(File2.OriginalPath),4)
File2.SaveAs FolderName & NewFileName2
SQLs = "UPDATE Item SET" & _
" ItemPic2 = '" & NewFileName2 & "'" & _
" WHERE ID = " & ID & ";"
conn.Execute(SQLs)
end if
'release resources
set File1 = nothing
set File2 = nothing
end if
set objUpload = nothing
call CloseConnection()
if not(act = empty) then response.Redirect "./posted.htm"
%>
Tag : ASP
|
|
|
|
|
|
Date :
2012-06-06 15:31:43 |
By :
SystemAnalysis |
View :
2544 |
Reply :
1 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ปิดพวก Statement เงื่อนไขไม่ถูกต้อง หรือเปล่าครับ
|
|
|
|
|
Date :
2012-06-06 21:41:20 |
By :
mr.win |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Load balance : Server 03
|