It's really strange. Why is there an error in my statement execution?
The cause of the error is that when counter> 10000, only the first four digits are displayed.
How can I solve this problem ........................
Source codeAs follows:
< % @ Page Language = " VB " Debug = " True " % >
< % @ Import Namespace = Namespace = " System. Io " % >
< Script Language = " VB " Runat = " Server " >
Function getfilename () Function Getfilename () As String
Dim Fullpath As String
Dim Position As Integer
Fullpath = Request. servervariables ( " Path_translated " )
Position = Rev (Fullpath, " . " )
Getfilename = Mid (Fullpath, 1 , Position) & " CNT"
End Function
Sub page_load () Sub Page_load (sender As Object , E As Eventargs)
If Not Page. ispostback () Then
Dim I As Integer
Dim IMG As Image
Dim Count As Integer
Dim Graph As String
Dim Mystream As Filestream
Dim Pathname, datastr As String
Dim Strreadobj As Streamreader
Dim Strwriteobj As Streamwriter
Pathname = Getfilename ()
Mystream = New Filestream (pathname, filemode. openorcreate, fileaccess. Read)
Strreadobj = New Streamreader (mystream)
Datastr = Strreadobj. Readline ()
Strreadobj. Close ()
Count = CINT (Datastr) + 1
For I = 1 To Len (Count)
IMG = New Image ()
Graph = Mid (Count, I, 1 )
If Graph = "" Then
IMG. imageurl = " Images/0.gif"
Else
IMG. imageurl = " Images/ " & Graph & " . GIF"
Mydiv. Controls. Add (IMG)
End If
Next
Mystream = New Filestream (pathname, filemode. Open, fileaccess. Write )
Strwriteobj = New Streamwriter (mystream)
Strwriteobj. Writeline (Count)
Strwriteobj. Close ()
End If
End sub
</ Script >
< Html >
< Head >
< Meta HTTP - Equiv = " Content-Type " Content = " Text/html; charset = gb2312 " >
< Title > Text counter </ Title >
</ Head >
< Body >
< Form runat = " Server " >
Number of visitors: < Div ID = " Mydiv " Runat = " Server " > </ Div >
</ Form >
</ Body >
</ Html >