XML + JavaScript + Access, make a personal account

xiaoxiao2021-03-06  145

The establishment of the database has been completed, adding records, modifying records, and simple statistics.

The following work is to add a lookup function, add statistics

I accidentally pressed the Power button last night, hehe! Written all. But fortunately, there is not much written.

The above-mentioned functionality has now been implemented. Through some code writing, learn the string in VB

Some functions of the operation, it is fine. Some information found from the Internet:

The string function in VBScript In VBScript, the system provides a large number of string functions to handle things related to strings. In JavaScript, the system provides a number of methods for String objects, and string variables can be used to use these methods without additional instructions, making the processing capability of strings more powerful. Here we introduce these functions and methods in batches. Target Task 1 Demonstrates the interception of the sub-string, the detail of the string, and the positioning of the substrings, etc.

Keyword left, right, mid, space, trim, instr, len codes dim Mystr, Myword, Mypos, BRMystr = "The built-in objects are special because they are built into ASP pages and do not need to be created before you can Use Them in Scripts. "Br =" "Document.write (" MyStr = "& chr (34) & mystr & chr (" String MyStr's length is "& len (mystr) & br ) Document.write ("7-bit left sub-string is" & left (mystr, 7) & br) Document.write ("8-bit left sub-string is" & Right (mystr, 8) & br) Document.write ("from The 5 characters started in 5 "& Mid (MySTR, 5, 12) & Br) Myword = Space (3) &" Hello "& Space (2) Document.write (CHR (34) & MYWORD & CHR (34)) Document.write ("The length of this string is" & Len (Myword) & Br) Document.write ("Septa before:" & chr (34) & ltrim (myword) & chr) & chr) myword = "Object" Document.write ("the myword =" & chr (34) & myword & chr (34)) Mypos = INSTR (MyStr, myword) if mypos = 0 thendocument.write ("Myword is not its substring") Elsedocument.write (Myword & "is a substring, the first start in" & mypos) end ifdocument.write brmyword = lcase (myword) mypos = INSTR (MyStr, myword) if mypos = 0 Thendocument.write ("Myword is not its substring "& Br) Elsedocument.wri TE (myword & "is a substring, the first start in the" & MYPOS) End IF Code This code demonstrates the usage of many string functions in VBScript, with the left sub-string Left, the right skewer Right, any child String MID, generate space string Space, intercepting the front guide PRIRM, cutting the tail space RTIRM, intercepting the presence of the front and rear space TIRN, the string length LEN, the existence of the sub-string and the appearance of the appearance INSTR. Size convert Ucase and LCase, convert the ASCII code into characters. The MID function returns the specified number of characters from the string, the syntax: MID (String, Start [, Length]) INSTR function returns a sub-string in the first time in the main string, if the subtrine does not exist, return 0.

Syntax: INSTR ([START,] STRING1, STRING2 [, Compare]) omitted the start position, and compare = 0 OR 1, indicating a binary comparison (0) or a comparison (1), default is binary comparison. See grammar reference for details. The syntax of other functions is clear from routine, and will not be described again. It is basically available now, but there is still a problem in the query, it has been asked on 9cbs. Waiting for an answer.

Now there is already a solution, and I have been solved. It turns out that the wildcard is wrong, and the ASP does not recognize "*" and should use "%"

Check

Think about what else thinking about:

1, can statistics on monthly, total expenditures, total revenue, and savings

2, it is best to make a chart, which can be compared for many months.

The first demand has been completed :)

First, put the form of the table clearly. Let a few pictures with Fireworks:

One is a Y-axis, the effective length is 480, the maximum value is 4000, and the scale is labeled 3000, 2000, 1000, 0.

Then there are several small collections that are included, branches, and the columns, and the color is selected, the height is 100.

The principle is simple, with 2000 unit 1 (picture height is 240, corresponding to the coordinate axis), and the different numbers account for 2000 ratios and then multiplied by 240.

The result is the height of the corresponding column.

Extract the public place:

Anyway, three consecutive three columns are some parts that are essential for each generation of charts, so take this one:

Function Draw (Inbox, Outbox) DIM HTM DIM H1, H2, H3 HTM = HTM & "HTM = HTM &"

Receive: "& Inbox &" Support: "& Outbox &" Yu: "& CINT (Inbox) -cint (Outbox) &" Response.write (HTM) end function

Description: Parameters Inbox and Outbox indicate the amount of income and expenditure, and the name of the rose :)

Then, the code is drawn, and the code is then extracted again:

'Timer head and Y-axis Function Drawheader () DIM HTM HTM = HTM & "

HTM = HTM & "" Response.write (HTM) end function

Function DrawBottom (M1, M2) DIM HTM DIM I HTM = "" "If it is just one month IF m1 = m2 Then HTM = HTM &"

"Else 'Multi-month for i = 0 to CINT (M2) -cint (m1) htm = htm &"

"Next HTM = HTM &"

"

END IF

Response.write (HTM)

END FUNCTION

Explanation: Parameters M1, M2 indicate two months before and after. If it is a month, then m1 = m2. According to this, there are several TDOKs at the end of the tail, and the materials are all piled up. Below is a function of drawing a chart of a certain time through several functions:

'Drawing drawtimezone () set rs = server.createObject ("adoDb.recordset") DIM SQL DIM Y1, M1, Y2, M2, TIME1, TIME2 DIM Inbox, Outbox Inbox = "0" Outbox = " 0 "Y1 = Request (" year1 ") M1 = Request (" MONTH1 ") D1 = Request (" day1 ") Y2 = Request (" year2 ") M2 = Request (" MONTH2 ") D2 = Request (" day2 ") Time1 = Y1 & "-" & M1 & "-" & D1 Time2 = Y2 & "-" & M2 & "-" & D2 SQL = "SELECT * from mycount where cdate (time)> = cdate ('" & Time1 & ") and cdate (TIME)

RS.Open SQL, CNN, 1, 3

IF not r.

While Not Rs.eof

IF RS (2) = 0 THEN

Inbox = CINT (Inbox) CINT (RS (4))

Else

Outbox = CINT (OUTBOX) CINT (RS (4))

END IF

rs.movenext

Wend

Else

END IF

Response.write (""

The following is the gross statistics between "& Time1 &" to "& Time2 &"

")

Call drawheader ()

Call Draw (Inbox, Outbox)

Call Drawbottom (M, M)

END FUNCTION

When I was written at the time, I thought it was very clear, but I was afraid that when I saw it again. No matter it, let's let go!

转载请注明原文地址:https://www.9cbs.com/read-127783.html

New Post(0)