%@ LANGUAGE=VBSCRIPT%>
<% OPTION EXPLICIT %>
<%On Error Resume Next%>
[an error occurred while processing this directive]
<%
Dim objDict
Dim mainpath, filename
Dim old_num, new_num, myDate
''INITIALIZE
create_Dictionary
objDict.Item("month") = fncFmtDate(date,"%m")
objDict.Item("day") = fncFmtDate(date,"%d")
objDict.Item("year") = fncFmtDate(date,"%Y")
If ( objDict.Item("month") < 10 ) Then
objDict.Item("month") = "0" & objDict.Item("month")
End If
If ( objDict.Item("day") < 10 ) Then
objDict.Item("day") = "0" & objDict.Item("day")
End If
'Main path
mainpath = strmainpath & "\mydb\"
'filename
filename = "count.txt"
'Call subroutine that
increment_number
objDict.Item("quote_number") = objDict.Item("year") & objDict.Item("month") & objDict.Item("day") & "-" & new_num
SUB increment_number
Dim objFSO, objOpenFile, objTS
Dim strFile
On Error Resume Next
'Set up to read the flat file db
Set objFSO = Server.CreateObject("Scripting.FileSystemObject")
If objFSO.FileExists(mainpath&filename) Then
Set objOpenFile = objFSO.GetFile(mainpath & filename)
Set objTS = objOpenFile.OpenAsTextStream(ForReading, TristateFalse)
Else
Response.Write "Error cannot open" & mainpath & filename
End if
'Read the file into a string
strFile = objTS.Read(objOpenFile.Size)
Set objFSO = Nothing
objTS.Close
Set objTS = Nothing
old_num = strFile
new_num = old_num + 1
'Setting up to write(update tracking number)
Set objFSO = Server.CreateObject("Scripting.FileSystemObject")
Set objOpenFile = objFSO.OpenTextFile(mainpath&filename, ForWriting, True)
If err.Number <> 0 then
Response.Clear
Response.Write mainpath&filename & "
"
Response.Write "ERROR " & err.Number & _
": DESCRIPTION - " & err.Description
Response.Flush
Response.End
End if
objOpenFile.Write(new_num)
Set objFSO = Nothing
objOpenFile.Close
Set objOpenFile = Nothing
End Sub
'***********************************************************************************************
' CREATE DICTIONARY OBJECT *
'***********************************************************************************************
Sub create_Dictionary
Dim item, key, str_method
Set objDict = CreateObject("Scripting.Dictionary")
str_method = lcase(TRIM(Request.ServerVariables("Request_Method")))
If str_method = "get" Then
for each item in Request.Querystring
If (item <> "Submit" OR item <> "action") Then
key = item
key = Replace(key,"req_","",1)
key = TRIM(key)
objDict.Item(key) = TRIM(Request(item))
End If
Next
Else
for each item in Request.Form
If (item <> "Submit" OR item <> "action") Then
key = item
key = Replace(key,"req_","",1)
key = TRIM(key)
objDict.Item(key) = TRIM(Request(item))
End If
Next
End If
End Sub
%>