rss search

next page next page close

Time Base Flagging with ASP datetime function

Time Base Flagging with ASP datetime function

<%

strStartTime1 = "13/02/2012 05:10:00"
strEndTime1 = "16/02/2012 05:11:00"

strDiff1 = DateDiff("n",strStartTime1,strEndTime1)

'response.write strDiff1
'response.write "<hr>"

if strDiff1 >=0  then
%>
<center> <h3>"ORDERS PLACED NOW FOR VALENTINE'S DAY - 14TH FEBRUARY WILL BE DELIVERED LATEST BY 15TH FEBRUARY"</h3> </center>
<%
else

end if 

%>
Share this:
Share this page via Email Share this page via Stumble Upon Share this page via Digg this Share this page via Facebook Share this page via Twitter

next page next page close

Dynamic Arrays

Dynamic arrays come in handy when you aren’t sure how many items your array will hold. To create a dynamic array you should use the Dim statement along with the array’s name, without specifying upper bound:

<%
Dim arrCars
arrCars = Array()
%>

In order to use this array you need to use the ReDim statement to define the array’s upper bound:

 

<%
Dim arrCars
arrCars = Array()
Redim arrCars(27)
%>

If in future you need to resize this array you should use the Redim statement again. Be very careful with the ReDim statement. When you use the ReDim statement you lose all elements of the array. Using the keyword PRESERVE in conjunction with the ReDim statement will keep the array we already have and increase the size:

<%
Dim arrCars
arrCars = Array()
Redim arrCars(27)
Redim PRESERVE arrCars(52)
%>
Share this:
Share this page via Email Share this page via Stumble Upon Share this page via Digg this Share this page via Facebook Share this page via Twitter

next page next page close

Static Arrays


<%@ LANGUAGE="VBSCRIPT" %>
<%
'Use the Dim statement along with the array name
'to create a static VBScript array
'The number in parentheses defines the array’s upper bound
Dim arrCars(4)
arrCars(0)="BMW"
arrCars(1)="Mercedes"
arrCars(2)="Audi"
arrCars(3)="Bentley"
arrCars(4)="Mini" 

'create a loop moving through the array
'and print out the values
For i=0 to 4
response.write arrCars(i) & "<br>"
Next     'move on to the next value of i
%>

Here is another way to define the array in VBScript:

<%
'we use the VBScript Array function along with a Dim statement
'to create and populate our array
Dim arrCars
arrCars = Array("BMW","Mercedes","Audi","Bentley","Mini") 'each element must be separated by a comma

'again we could loop through the array and print out the values
For i=0 to 4
response.write arrCars(i) & "<br>"
Next
%>
Share this:
Share this page via Email Share this page via Stumble Upon Share this page via Digg this Share this page via Facebook Share this page via Twitter

next page next page close

Selected Characters from VBA’s Character Code Set

 

 
Character Code      Character         
8                   backspace        
9                   Tab        
10                  linefeed        
13                  carriage return        
32                  [space]        
33                  !        
34                  "        
35                  #        
36                  $        
37                  %        
38                  &        
39                  '        
40                  (        
41                  )        
42                  *        
43                  +        
44                  ,        
45                  -        
46                  .        
47                  /        
48                  0        
49                  1        
50                  2        
51                  3        
52                  4        
53                  5        
54                  6        
55                  7        
56                  8        
57                  9        
58                  :        
59                  ;        
60                  <        
61                  =        
62                  >        
63                  ?        
64                  @        
65                  A        
66                  B        
67                  C        
68                  D        
69                  E        
70                  F        
71                  G        
72                  H        
73                  I        
74                  J        
75                  K        
76                  L        
77                  M        
78                  N        
79                  O        
80                  P        
81                  Q        
82                  R        
83                  S        
84                  T        
85                  U        
86                  V        
87                  W        
88                  X        
89                  Y        
90                  Z        
91                  [        
92                  \        
93                  ]        
94                  ^        
95                  _        
96                  '        
97                  a        
98                  b        
99                  c        
100                 d        
101                 e        
102                 f        
103                 g        
104                 h        
105                 i        
106                 j        
107                 k        
108                 l        
109                 m        
110                 n        
111                 o        
112                 p        
113                 q        
114                 r        
115                 s        
116                 t        
117                 u        
118                 v        
119                 w        
120                 x        
121                 y        
122                 z        
123                 {        
124                 |        
125                 }        
126                 ~     

 

Share this:
Share this page via Email Share this page via Stumble Upon Share this page via Digg this Share this page via Facebook Share this page via Twitter

next page next page close

Format Medium Date

The FormatMediumDate function returns mm/dd/yyyy, unlike (FormatDateTime(Now(),2) which only returns mm/dd/yy.

The FormatMediumDate function returns mm/dd/yyyy, unlike (FormatDateTime(Now(),2) which only returns mm/dd/yy.

Syntax:

mediumdate = FormatMediumDate(datevar)
Example Usage:
<% = FormatMediumDate(rs("date")) %>
ASP Source Code:
<%
Function FormatMediumDate(DateValue)
    Dim strYYYY
    Dim strMM
    Dim strDD

        strYYYY = CStr(DatePart("yyyy", DateValue))

        strMM = CStr(DatePart("m", DateValue))
        If Len(strMM) = 1 Then strMM = "0" & strMM

        strDD = CStr(DatePart("d", DateValue))
        If Len(strDD) = 1 Then strDD = "0" & strDD

        FormatMediumDate = strMM & "/" & strDD & "/" & strYYYY

End Function
%>
Share this:
Share this page via Email Share this page via Stumble Upon Share this page via Digg this Share this page via Facebook Share this page via Twitter

next page next page close

Access Secure files on local machine or the network drives

<%
'####### Created By Pranav Ajgaonkar
'####### 12th July 2010
'####### PSCS E-BUSINESS
'####### WWW.PSCSGLOBAL.COM
'####### Access Secure files on local machine or the network drives
'####### pranav.aj@pscsglobal.com

'###### Validate User Session
'If session("loggedIn") = True Then

'###### Demo Version
'###### Enter your File Name
'###### In the Live Version develop a function to identify the File-Name based on the User Session EMP Code

'###### Place This File in C:\
	testingFilename = "testfile.pdf"

'###### File Path (Local Drive or Network Drive)
	strFilePath = "C:\" & testingFilename '  & request.querystring("filename")

'#####################################
'#####################################
'#########					 #########
'######### Do Not Edit Below #########
'#########					 #########
'#####################################
'#####################################
	Set objFSO = Server.CreateObject("Scripting.FileSystemObject")
		If objFSO.FileExists(strFilePath) Then
		Set objFile = objFSO.GetFile(strFilePath)
		intFileSize = objFile.Size
	Set objFile = Nothing

		strFileName = testingFilename ' request.querystring("filename")
		strFileName = replace(testingFilename," ","-") 'replace(request.querystring("filename")," ","-")

			Response.AddHeader "Content-Disposition","attachment; filename=" & strFileName
			Response.ContentType = "application/x-msdownload"
			Response.AddHeader "Content-Length", intFileSize

Set objStream = Server.CreateObject("ADODB.Stream")
objStream.Open
objStream.Type = 1 'adTypeBinary
objStream.LoadFromFile strFilePath
	Do While Not objStream.EOS And Response.IsClientConnected
		Response.BinaryWrite objStream.Read(1024)
		Response.Flush()
	Loop
objStream.Close

Set objStream = Nothing
Else
	Response.write "Error finding file."
End if

	Set objFSO = Nothing
'End If
%>
Share this:
Share this page via Email Share this page via Stumble Upon Share this page via Digg this Share this page via Facebook Share this page via Twitter

next page

Time Base Flagging with ASP datetime function

Share|Time Base Flagging with ASP datetime function <% strStartTime1 = "13/02/2012...
article post

Dynamic Arrays

Share|Dynamic arrays come in handy when you aren’t sure how many items your array...
article post

Static Arrays

Share| <%@ LANGUAGE="VBSCRIPT" %> <% 'Use the Dim statement along with the array...
article post

Selected Characters from VBA’s Character Code Set

...
article post

Format Medium Date

Share|The FormatMediumDate function returns mm/dd/yyyy, unlike (FormatDateTime(Now(),2)...
article post

Access Secure files on local machine or the network drives

Share|<% '####### Created By Pranav Ajgaonkar '####### 12th July 2010 '####### PSCS...
article post

Devguru.in is Stephen Fry proof thanks to caching by WP Super Cache