%
option explicit
Response.Buffer = true
if session("company_id") <> "" then
dim conn
dim rs
dim ssql
dim sSub_Category_Id
dim sSub_Category_Name
dim sSub_Category_Description
dim sShow_All
dim return_page
%>
<%
sSub_Category_Id = trim(Request.Form("sub_category_id"))
sSub_Category_Name = trim(Request.Form("sub_category_name"))
sSub_Category_Description = trim(Request.Form("sub_category_description"))
sShow_All = trim(Request.Form("show_all_item"))
'replace vbCrLf to
if len(sSub_Category_Description) > 0 then
sSub_Category_Description = replace(sSub_Category_Description, vbcrlf, "
", 1, -1, 1)
end if
'update data
ssql = "select * from tbl_sub_category where sub_category_id = '" & sSub_Category_Id & "'"
set rs = server.CreateObject("adodb.recordset")
rs.Open ssql,conn,3,3
rs.Fields("sub_category_name") = sSub_Category_Name
rs.Fields("sub_category_description") = sSub_Category_Description
rs.Update
rs.Close
conn.Close
set rs = nothing
set conn = nothing
dim file
dim objfs
dim objfile
'update data
set objfs = server.CreateObject("scripting.FileSystemObject")
if objfs.FileExists(server.MapPath("../../../../../member/" & Request.Cookies("storename") & "/cat" & sSub_Category_Id & ".txt")) = true then
objfs.DeleteFile server.MapPath("../../../../../member/" & Request.Cookies("storename") & "/cat" & sSub_Category_Id & ".txt"),0
end if
set objfile = objfs.OpenTextFile(server.MapPath("../../../../../member/" & Request.Cookies("storename") & "/cat" & sSub_Category_Id & ".txt"),8,-1,0)
objfile.WriteLine sShow_All
objfile.close
set objfile = nothing
return_page = ""
Response.Write return_page
else
Response.Redirect "../../index.asp"
end if
%>