<% Response.Expires = 0 Response.ExpiresAbsolute = Now() - 1 Response.AddHeader "pragma", "no-cache" Response.AddHeader "cache-control", "private, no-cache, no-store, must-revalidate" %> <% If Not IsLoggedIn And Request.Cookies(ewProjectName)("autologin") = "autologin" And Request.Cookies(ewProjectName)("password") <> "" Then Response.Redirect "login.asp" Call LoadUserLevel() If IsLoggedIn Then ewCurSec = CurrentUserLevelPriv("hotels") Else ewCurSec = GetAnonymousPriv("hotels") End If If (ewCurSec And ewAllowAdd) <> ewAllowAdd Then Response.Redirect "hotelslist.asp" %> <% ' Initialize common variables x_HotelID = Null: ox_HotelID = Null: z_HotelID = Null x_HotelLogo = Null: ox_HotelLogo = Null: z_HotelLogo = Null fs_x_HotelLogo = 0: fn_x_HotelLogo = "": ct_x_HotelLogo = "" wd_x_HotelLogo = 0: ht_x_HotelLogo = 0: a_x_HotelLogo = "" x_HotelName = Null: ox_HotelName = Null: z_HotelName = Null x_HotelCategory = Null: ox_HotelCategory = Null: z_HotelCategory = Null x_Governorate = Null: ox_Governorate = Null: z_Governorate = Null x_BtriefLocation = Null: ox_BtriefLocation = Null: z_BtriefLocation = Null x_HotelDescription = Null: ox_HotelDescription = Null: z_HotelDescription = Null x_Photo1 = Null: ox_Photo1 = Null: z_Photo1 = Null fs_x_Photo1 = 0: fn_x_Photo1 = "": ct_x_Photo1 = "" wd_x_Photo1 = 0: ht_x_Photo1 = 0: a_x_Photo1 = "" x_Photo2 = Null: ox_Photo2 = Null: z_Photo2 = Null fs_x_Photo2 = 0: fn_x_Photo2 = "": ct_x_Photo2 = "" wd_x_Photo2 = 0: ht_x_Photo2 = 0: a_x_Photo2 = "" x_Photo3 = Null: ox_Photo3 = Null: z_Photo3 = Null fs_x_Photo3 = 0: fn_x_Photo3 = "": ct_x_Photo3 = "" wd_x_Photo3 = 0: ht_x_Photo3 = 0: a_x_Photo3 = "" x_Photo4 = Null: ox_Photo4 = Null: z_Photo4 = Null fs_x_Photo4 = 0: fn_x_Photo4 = "": ct_x_Photo4 = "" wd_x_Photo4 = 0: ht_x_Photo4 = 0: a_x_Photo4 = "" x_Photo5 = Null: ox_Photo5 = Null: z_Photo5 = Null fs_x_Photo5 = 0: fn_x_Photo5 = "": ct_x_Photo5 = "" wd_x_Photo5 = 0: ht_x_Photo5 = 0: a_x_Photo5 = "" x_Photo6 = Null: ox_Photo6 = Null: z_Photo6 = Null fs_x_Photo6 = 0: fn_x_Photo6 = "": ct_x_Photo6 = "" wd_x_Photo6 = 0: ht_x_Photo6 = 0: a_x_Photo6 = "" x_NearbySightseeing = Null: ox_NearbySightseeing = Null: z_NearbySightseeing = Null x_HotelFacilities = Null: ox_HotelFacilities = Null: z_HotelFacilities = Null x_RoomFacilities = Null: ox_RoomFacilities = Null: z_RoomFacilities = Null x_RoomCategory = Null: ox_RoomCategory = Null: z_RoomCategory = Null x_RoomFacilitiesCategory = Null: ox_RoomFacilitiesCategory = Null: z_RoomFacilitiesCategory = Null x_RoomFacilitiesSubcategory = Null: ox_RoomFacilitiesSubcategory = Null: z_RoomFacilitiesSubcategory = Null x_Featured = Null: ox_Featured = Null: z_Featured = Null %> <% Response.Buffer = True ' Load key from QueryString bCopy = True x_HotelID = Request.QueryString("HotelID") If x_HotelID = "" Or IsNull(x_HotelID) Then bCopy = False End If sAction = "" If Not RequestBlobData() Then If bCopy Then sAction = "C" ' Copy Record Else sAction = "I" ' Display Blank Record End If End If ' Open connection to the database Set conn = Server.CreateObject("ADODB.Connection") conn.Open xDb_Conn_Str Select Case sAction Case "C": ' Get a record to display If Not LoadData() Then ' Load Record based on key Session(ewSessionMessage) = "No records found" conn.Close ' Close Connection Set conn = Nothing Response.Clear Response.Redirect "hotelslist.asp" End If Case "A": ' Add If AddData() Then ' Add New Record Session(ewSessionMessage) = "Add New Record Successful" conn.Close ' Close Connection Set conn = Nothing Response.Clear Response.Redirect "hotelslist.asp" Else End If End Select %>

Add to TABLE: hotels

Back to List

<% If Session(ewSessionMessage) <> "" Then %>

<%= Session(ewSessionMessage) %>

<% Session(ewSessionMessage) = "" ' Clear message End If %>

<% If Session(ewSessionMessage) <> "" Then %>

<%= Session(ewSessionMessage) %>

<% Session(ewSessionMessage) = "" ' Clear message End If %>
Hotel Logo
Hotel Name * ">
Hotel Category * <% lst_x_HotelCategory = "" Response.Write lst_x_HotelCategory %>
City * <% lst_x_Governorate = "" Response.Write lst_x_Governorate %>
Hotel Description *
Photo 1
Photo 2
Photo 3
Photo 4
Photo 5
Photo 6
Nearby Sightseeing
Hotel Facilities * <% sSqlWrk = "SELECT `HotelFacilities` FROM `hotelfacilities`" chk_x_HotelFacilities = "" Set rswrk = Server.CreateObject("ADODB.Recordset") rswrk.Open sSqlWrk, conn If Not rswrk.Eof Then datawrk = rswrk.GetRows rowswrk = UBound(datawrk, 2) ar_x_HotelFacilities = split(x_HotelFacilities&"",",") For rowcntwrk = 0 To rowswrk chk_x_HotelFacilities = chk_x_HotelFacilities & RenderControl(rowswrk, rowcntwrk, 3, 1) & "" & datawrk(0, rowcntwrk) & RenderControl(rowswrk, rowcntwrk, 3, 2) Next End If rswrk.Close Set rswrk = Nothing Response.Write chk_x_HotelFacilities %>
Room Facilities * <% sSqlWrk = "SELECT `RoomFacilities` FROM `roomfacilities`" chk_x_RoomFacilities = "" Set rswrk = Server.CreateObject("ADODB.Recordset") rswrk.Open sSqlWrk, conn If Not rswrk.Eof Then datawrk = rswrk.GetRows rowswrk = UBound(datawrk, 2) ar_x_RoomFacilities = split(x_RoomFacilities&"",",") For rowcntwrk = 0 To rowswrk chk_x_RoomFacilities = chk_x_RoomFacilities & RenderControl(rowswrk, rowcntwrk, 3, 1) & "" & datawrk(0, rowcntwrk) & RenderControl(rowswrk, rowcntwrk, 3, 2) Next End If rswrk.Close Set rswrk = Nothing Response.Write chk_x_RoomFacilities %>
Room Category <% lst_x_RoomCategory = "" Response.Write lst_x_RoomCategory %>
Room Facilities Category <% lst_x_RoomFacilitiesCategory = "" Response.Write lst_x_RoomFacilitiesCategory %>
Room Facilities Subcategory <% lst_x_RoomFacilitiesSubcategory = "" Response.Write lst_x_RoomFacilitiesSubcategory %>  Add Room Facilities Subcategory
Featured * <% If IsNull(x_Featured) or x_Featured = "" Then x_Featured = "No" ' Set default value %> <% lst_x_Featured = "" Response.Write lst_x_Featured %>

<% conn.Close ' Close Connection Set conn = Nothing %> <% '------------------------------------------------------------------------------- ' Function RequestBlobData ' - Handle mult-part data (for file upload) ' - Variables setup: sAction, field variables, EW_Max_File_Size Function RequestBlobData() Dim rawData, separator, lenSeparator, dict Dim currentPos, inStrByte, tempValue, mValue, value Dim intDict, begPos, endPos Dim nameN, isValid, nameValue, midValue Dim rawStream If Request.TotalBytes > 0 Then Set rawStream = Server.CreateObject("ADODB.Stream") rawStream.Type = 1 'adTypeBinary rawStream.Mode = 3 'adModeReadWrite rawStream.Open rawStream.Write Request.BinaryRead(Request.TotalBytes) rawStream.Position = 0 rawData = rawStream.Read separator = MidB(rawData, 1, InStrB(1, rawData, ChrB(13)) - 1) lenSeparator = LenB(separator) Set dict = Server.CreateObject("Scripting.Dictionary") currentPos = 1 inStrByte = 1 tempValue = "" While inStrByte > 0 inStrByte = InStrB(currentPos, rawData, separator) mValue = inStrByte - currentPos If mValue > 1 Then value = MidB(rawData, currentPos, mValue) Set intDict = Server.CreateObject("Scripting.Dictionary") begPos = 1 + InStrB(1, value, ChrB(34)) endPos = InStrB(begPos + 1, value, ChrB(34)) nameN = MidB(value, begPos, endPos - begPos) isValid = True If InStrB(1, value, stringToByte("Content-Type")) > 1 Then begPos = 1 + InStrB(endPos + 1, value, ChrB(34)) endPos = InStrB(begPos + 1, value, ChrB(34)) If endPos > 0 Then intDict.Add "FileName", ConvertToText(rawStream, currentPos + begPos - 2, endPos - begPos, MidB(value, begPos, endPos - begPos)) begPos = 14 + InStrB(endPos + 1, value, StringToByte("Content-Type:")) endPos = InStrB(begPos, value, ChrB(13)) intDict.Add "ContentType", ConvertToText(rawStream, currentPos + begPos - 2, endPos - begPos, MidB(value, begPos, endPos - begPos)) begPos = endPos + 4 endPos = LenB(value) nameValue = MidB(value, begPos, ((endPos - begPos) - 1)) Else endPos = begPos + 1 isValid = False End If Else nameValue = ConvertToText(rawStream, currentPos + endPos + 3, mValue - endPos - 4, MidB(value, endPos + 5)) End If If isValid = True Then If dict.Exists(byteToString(nameN)) Then Set intDict = dict.Item(byteToString(nameN)) If Right(intDict.Item("Value"), 2) = vbCrLf Then intDict.Item("Value") = Left(intDict.Item("Value"), Len(intDict.Item("Value"))-2) End If intDict.Item("Value") = intDict.Item("Value") & ", " & nameValue Else intDict.Add "Value", nameValue intDict.Add "Name", nameN dict.Add byteToString(nameN), intDict End If End If End If currentPos = lenSeparator + inStrByte Wend rawStream.Close Set rawStream = Nothing ' Get action sAction = getValue(dict, "a_add") EW_Max_File_Size = getValue(dict, "EW_Max_File_Size") x_HotelID = getValue(dict, "x_HotelID") fs_x_HotelLogo = getFileSize(dict, "x_HotelLogo") ' Check the file size If fs_x_HotelLogo > 0 And CLng(EW_Max_File_Size) > 0 Then If fs_x_HotelLogo > CLng(EW_Max_File_Size) Then Response.Write Replace("Max. file size (%s bytes) exceeded.", "%s", EW_Max_File_Size) Response.End End If End If fn_x_HotelLogo = getFileName(dict, "x_HotelLogo") ' Check the file type If Not ewUploadAllowedFileExt(fn_x_HotelLogo) Then Response.Write "File type is not allowed." Response.End End If ct_x_HotelLogo = getFileContentType(dict, "x_HotelLogo") x_HotelLogo = getFileData(dict, "x_HotelLogo") Call ewGetImageDimension(x_HotelLogo, wd_x_HotelLogo, ht_x_HotelLogo) If wd_x_HotelLogo < 0 Or ht_x_HotelLogo < 0 Then wd_x_HotelLogo = getValue(dict, "wd_x_HotelLogo") ht_x_HotelLogo = getValue(dict, "ht_x_HotelLogo") End If a_x_HotelLogo = getValue(dict, "a_x_HotelLogo") x_HotelName = getValue(dict, "x_HotelName") x_HotelCategory = getValue(dict, "x_HotelCategory") x_Governorate = getValue(dict, "x_Governorate") x_BtriefLocation = getValue(dict, "x_BtriefLocation") x_HotelDescription = getValue(dict, "x_HotelDescription") fs_x_Photo1 = getFileSize(dict, "x_Photo1") ' Check the file size If fs_x_Photo1 > 0 And CLng(EW_Max_File_Size) > 0 Then If fs_x_Photo1 > CLng(EW_Max_File_Size) Then Response.Write Replace("Max. file size (%s bytes) exceeded.", "%s", EW_Max_File_Size) Response.End End If End If fn_x_Photo1 = getFileName(dict, "x_Photo1") ' Check the file type If Not ewUploadAllowedFileExt(fn_x_Photo1) Then Response.Write "File type is not allowed." Response.End End If ct_x_Photo1 = getFileContentType(dict, "x_Photo1") x_Photo1 = getFileData(dict, "x_Photo1") Call ewGetImageDimension(x_Photo1, wd_x_Photo1, ht_x_Photo1) If wd_x_Photo1 < 0 Or ht_x_Photo1 < 0 Then wd_x_Photo1 = getValue(dict, "wd_x_Photo1") ht_x_Photo1 = getValue(dict, "ht_x_Photo1") End If a_x_Photo1 = getValue(dict, "a_x_Photo1") fs_x_Photo2 = getFileSize(dict, "x_Photo2") ' Check the file size If fs_x_Photo2 > 0 And CLng(EW_Max_File_Size) > 0 Then If fs_x_Photo2 > CLng(EW_Max_File_Size) Then Response.Write Replace("Max. file size (%s bytes) exceeded.", "%s", EW_Max_File_Size) Response.End End If End If fn_x_Photo2 = getFileName(dict, "x_Photo2") ' Check the file type If Not ewUploadAllowedFileExt(fn_x_Photo2) Then Response.Write "File type is not allowed." Response.End End If ct_x_Photo2 = getFileContentType(dict, "x_Photo2") x_Photo2 = getFileData(dict, "x_Photo2") Call ewGetImageDimension(x_Photo2, wd_x_Photo2, ht_x_Photo2) If wd_x_Photo2 < 0 Or ht_x_Photo2 < 0 Then wd_x_Photo2 = getValue(dict, "wd_x_Photo2") ht_x_Photo2 = getValue(dict, "ht_x_Photo2") End If a_x_Photo2 = getValue(dict, "a_x_Photo2") fs_x_Photo3 = getFileSize(dict, "x_Photo3") ' Check the file size If fs_x_Photo3 > 0 And CLng(EW_Max_File_Size) > 0 Then If fs_x_Photo3 > CLng(EW_Max_File_Size) Then Response.Write Replace("Max. file size (%s bytes) exceeded.", "%s", EW_Max_File_Size) Response.End End If End If fn_x_Photo3 = getFileName(dict, "x_Photo3") ' Check the file type If Not ewUploadAllowedFileExt(fn_x_Photo3) Then Response.Write "File type is not allowed." Response.End End If ct_x_Photo3 = getFileContentType(dict, "x_Photo3") x_Photo3 = getFileData(dict, "x_Photo3") Call ewGetImageDimension(x_Photo3, wd_x_Photo3, ht_x_Photo3) If wd_x_Photo3 < 0 Or ht_x_Photo3 < 0 Then wd_x_Photo3 = getValue(dict, "wd_x_Photo3") ht_x_Photo3 = getValue(dict, "ht_x_Photo3") End If a_x_Photo3 = getValue(dict, "a_x_Photo3") fs_x_Photo4 = getFileSize(dict, "x_Photo4") ' Check the file size If fs_x_Photo4 > 0 And CLng(EW_Max_File_Size) > 0 Then If fs_x_Photo4 > CLng(EW_Max_File_Size) Then Response.Write Replace("Max. file size (%s bytes) exceeded.", "%s", EW_Max_File_Size) Response.End End If End If fn_x_Photo4 = getFileName(dict, "x_Photo4") ' Check the file type If Not ewUploadAllowedFileExt(fn_x_Photo4) Then Response.Write "File type is not allowed." Response.End End If ct_x_Photo4 = getFileContentType(dict, "x_Photo4") x_Photo4 = getFileData(dict, "x_Photo4") Call ewGetImageDimension(x_Photo4, wd_x_Photo4, ht_x_Photo4) If wd_x_Photo4 < 0 Or ht_x_Photo4 < 0 Then wd_x_Photo4 = getValue(dict, "wd_x_Photo4") ht_x_Photo4 = getValue(dict, "ht_x_Photo4") End If a_x_Photo4 = getValue(dict, "a_x_Photo4") fs_x_Photo5 = getFileSize(dict, "x_Photo5") ' Check the file size If fs_x_Photo5 > 0 And CLng(EW_Max_File_Size) > 0 Then If fs_x_Photo5 > CLng(EW_Max_File_Size) Then Response.Write Replace("Max. file size (%s bytes) exceeded.", "%s", EW_Max_File_Size) Response.End End If End If fn_x_Photo5 = getFileName(dict, "x_Photo5") ' Check the file type If Not ewUploadAllowedFileExt(fn_x_Photo5) Then Response.Write "File type is not allowed." Response.End End If ct_x_Photo5 = getFileContentType(dict, "x_Photo5") x_Photo5 = getFileData(dict, "x_Photo5") Call ewGetImageDimension(x_Photo5, wd_x_Photo5, ht_x_Photo5) If wd_x_Photo5 < 0 Or ht_x_Photo5 < 0 Then wd_x_Photo5 = getValue(dict, "wd_x_Photo5") ht_x_Photo5 = getValue(dict, "ht_x_Photo5") End If a_x_Photo5 = getValue(dict, "a_x_Photo5") fs_x_Photo6 = getFileSize(dict, "x_Photo6") ' Check the file size If fs_x_Photo6 > 0 And CLng(EW_Max_File_Size) > 0 Then If fs_x_Photo6 > CLng(EW_Max_File_Size) Then Response.Write Replace("Max. file size (%s bytes) exceeded.", "%s", EW_Max_File_Size) Response.End End If End If fn_x_Photo6 = getFileName(dict, "x_Photo6") ' Check the file type If Not ewUploadAllowedFileExt(fn_x_Photo6) Then Response.Write "File type is not allowed." Response.End End If ct_x_Photo6 = getFileContentType(dict, "x_Photo6") x_Photo6 = getFileData(dict, "x_Photo6") Call ewGetImageDimension(x_Photo6, wd_x_Photo6, ht_x_Photo6) If wd_x_Photo6 < 0 Or ht_x_Photo6 < 0 Then wd_x_Photo6 = getValue(dict, "wd_x_Photo6") ht_x_Photo6 = getValue(dict, "ht_x_Photo6") End If a_x_Photo6 = getValue(dict, "a_x_Photo6") x_NearbySightseeing = getValue(dict, "x_NearbySightseeing") x_HotelFacilities = getValue(dict, "x_HotelFacilities") x_RoomFacilities = getValue(dict, "x_RoomFacilities") x_RoomCategory = getValue(dict, "x_RoomCategory") x_RoomFacilitiesCategory = getValue(dict, "x_RoomFacilitiesCategory") x_RoomFacilitiesSubcategory = getValue(dict, "x_RoomFacilitiesSubcategory") x_Featured = getValue(dict, "x_Featured") If IsObject(intDict) Then intDict.RemoveAll Set intDict = Nothing End If dict.RemoveAll Set dict = Nothing RequestBlobData = True Else RequestBlobData = False End If End Function %> <% '------------------------------------------------------------------------------- ' Function LoadData ' - Load Data based on Key Value ' - Variables setup: field variables Function LoadData() Dim rs, sSql, sFilter sFilter = ewSqlKeyWhere If Not IsNumeric(x_HotelID) Then LoadData = False Exit Function End If sFilter = Replace(sFilter, "@HotelID", AdjustSql(x_HotelID)) ' Replace key value sSql = ewBuildSql(ewSqlSelect, ewSqlWhere, ewSqlGroupBy, ewSqlHaving, ewSqlOrderBy, sFilter, "") Set rs = Server.CreateObject("ADODB.Recordset") rs.Open sSql, conn If rs.Eof Then LoadData = False Else LoadData = True rs.MoveFirst ' Get the field contents x_HotelID = rs("HotelID") x_HotelLogo = rs("HotelLogo") x_HotelName = rs("HotelName") x_HotelCategory = rs("HotelCategory") x_Governorate = rs("Governorate") x_BtriefLocation = rs("BtriefLocation") x_HotelDescription = rs("HotelDescription") x_Photo1 = rs("Photo1") x_Photo2 = rs("Photo2") x_Photo3 = rs("Photo3") x_Photo4 = rs("Photo4") x_Photo5 = rs("Photo5") x_Photo6 = rs("Photo6") x_NearbySightseeing = rs("NearbySightseeing") x_HotelFacilities = rs("HotelFacilities") x_RoomFacilities = rs("RoomFacilities") x_RoomCategory = rs("RoomCategory") x_RoomFacilitiesCategory = rs("RoomFacilitiesCategory") x_RoomFacilitiesSubcategory = rs("RoomFacilitiesSubcategory") x_Featured = rs("Featured") End If rs.Close Set rs = Nothing End Function %> <% '------------------------------------------------------------------------------- ' Function AddData ' - Add Data ' - Variables used: field variables Function AddData() On Error Resume Next Dim rs, sSql, sFilter Dim rsnew Dim bCheckKey, sSqlChk, sWhereChk sFilter = ewSqlKeyWhere ' Check for duplicate key bCheckKey = True If x_HotelID = "" Or IsNull(x_HotelID) Then bCheckKey = False Else sFilter = Replace(sFilter, "@HotelID", AdjustSql(x_HotelID)) ' Replace key value End If If Not IsNumeric(x_HotelID) Then bCheckKey = False End If If bCheckKey Then sSqlChk = ewBuildSql(ewSqlSelect, ewSqlWhere, ewSqlGroupBy, ewSqlHaving, ewSqlOrderBy, sFilter, "") Set rsChk = conn.Execute(sSqlChk) If Err.Number <> 0 Then Session(ewSessionMessage) = Err.Description rsChk.Close Set rsChk = Nothing AddData = False Exit Function ElseIf Not rsChk.Eof Then Session(ewSessionMessage) = "Duplicate value for primary key" rsChk.Close Set rsChk = Nothing AddData = False Exit Function End If rsChk.Close Set rsChk = Nothing End If ' Add New Record sFilter = "(0 = 1)" sSql = ewBuildSql(ewSqlSelect, ewSqlWhere, ewSqlGroupBy, ewSqlHaving, ewSqlOrderBy, sFilter, "") Set rs = Server.CreateObject("ADODB.Recordset") rs.CursorLocation = 3 rs.Open sSql, conn, 1, 2 If Err.Number <> 0 Then Session(ewSessionMessage) = Err.Description rs.Close Set rs = Nothing AddData = False Exit Function End If rs.AddNew ' Field HotelLogo sTmp = x_HotelLogo If Trim(sTmp) = "" Then sTmp = Null If IsNull(sTmp) Then rs("HotelLogo") = Null Else rs("HotelLogo").AppendChunk sTmp End If ' Field HotelName sTmp = Trim(x_HotelName) If Trim(sTmp) = "" Then sTmp = "" rs("HotelName") = sTmp ' Field HotelCategory sTmp = Trim(x_HotelCategory) If Trim(sTmp) = "" Then sTmp = "" rs("HotelCategory") = sTmp ' Field Governorate sTmp = Trim(x_Governorate) If Trim(sTmp) = "" Then sTmp = "" rs("Governorate") = sTmp ' Field HotelDescription sTmp = Trim(x_HotelDescription) If Trim(sTmp) = "" Then sTmp = "" rs("HotelDescription") = sTmp ' Field Photo1 sTmp = x_Photo1 If Trim(sTmp) = "" Then sTmp = Null If IsNull(sTmp) Then rs("Photo1") = Null Else rs("Photo1").AppendChunk sTmp End If ' Field Photo2 sTmp = x_Photo2 If Trim(sTmp) = "" Then sTmp = Null If IsNull(sTmp) Then rs("Photo2") = Null Else rs("Photo2").AppendChunk sTmp End If ' Field Photo3 sTmp = x_Photo3 If Trim(sTmp) = "" Then sTmp = Null If IsNull(sTmp) Then rs("Photo3") = Null Else rs("Photo3").AppendChunk sTmp End If ' Field Photo4 sTmp = x_Photo4 If Trim(sTmp) = "" Then sTmp = Null If IsNull(sTmp) Then rs("Photo4") = Null Else rs("Photo4").AppendChunk sTmp End If ' Field Photo5 sTmp = x_Photo5 If Trim(sTmp) = "" Then sTmp = Null If IsNull(sTmp) Then rs("Photo5") = Null Else rs("Photo5").AppendChunk sTmp End If ' Field Photo6 sTmp = x_Photo6 If Trim(sTmp) = "" Then sTmp = Null If IsNull(sTmp) Then rs("Photo6") = Null Else rs("Photo6").AppendChunk sTmp End If ' Field NearbySightseeing sTmp = Trim(x_NearbySightseeing) If Trim(sTmp) = "" Then sTmp = Null rs("NearbySightseeing") = sTmp ' Field HotelFacilities sTmp = Trim(x_HotelFacilities) If Trim(sTmp) = "" Then sTmp = "" rs("HotelFacilities") = sTmp ' Field RoomFacilities sTmp = Trim(x_RoomFacilities) If Trim(sTmp) = "" Then sTmp = "" rs("RoomFacilities") = sTmp ' Field RoomCategory sTmp = Trim(x_RoomCategory) If Trim(sTmp) = "" Then sTmp = Null rs("RoomCategory") = sTmp ' Field RoomFacilitiesCategory sTmp = Trim(x_RoomFacilitiesCategory) If Trim(sTmp) = "" Then sTmp = Null rs("RoomFacilitiesCategory") = sTmp ' Field RoomFacilitiesSubcategory sTmp = Trim(x_RoomFacilitiesSubcategory) If Trim(sTmp) = "" Then sTmp = Null rs("RoomFacilitiesSubcategory") = sTmp ' Field Featured sTmp = Trim(x_Featured) If Trim(sTmp) = "" Then sTmp = "" rs("Featured") = sTmp ' Call recordset inserting event If Recordset_Inserting(rs) Then ' Clone new rs object Set rsnew = CloneRs(rs) rs.Update If Err.Number <> 0 Then Session(ewSessionMessage) = Err.Description AddData = False Else AddData = True End If Else rs.CancelUpdate AddData = False End If rs.Close Set rs = Nothing ' Call recordset inserted event If AddData Then Call Recordset_Inserted(rsnew) End If rsnew.Close Set rsnew = Nothing End Function '------------------------------------------------------------------------------- ' Recordset inserting event Function Recordset_Inserting(rsnew) On Error Resume Next ' Please enter your customized codes here Recordset_Inserting = True End Function '------------------------------------------------------------------------------- ' Recordset inserted event Sub Recordset_Inserted(rsnew) On Error Resume Next Dim table table = "hotels" ' Get key value Dim sKey sKey = "" If sKey <> "" Then sKey = sKey & "," sKey = sKey & rsnew.Fields("HotelID") x_HotelID = rsnew.Fields("HotelID") End Sub %>