I just saw a program written by a friend that uses javascript to connect to an excel database. I wanted to change it to an access database, so I found these two articles
———————————————————————— ----------------------------
I have spent a lot of effort in the past few days to find ways to connect javascript to the access database on the Internet,
After sorting and summarizing, I finally wrote a piece of code that can be effectively executed.
But this code can run normally locally, but once it is placed on a free personal space, it cannot be executed. The main reason is that the operation permissions are insufficient, because most free spaces that only support static pages
has made very strict restrictions, so whether it is using mdb or reading and writing plain text files,
cannot pass, and a js error will be reported by the page. Some free spaces abroad directly prohibit the uploading of files with extensions like mdb
.
Although there is no hope of making your own counter or message board on the free space of purely static pages,
this program may still be useful to some friends, so I wrote it for you to study.
File composition:
The Access database is named MyData.Mdb, and a table named count is built in it. The table consists of two
fields: ID and COUNT, and there is a piece of data in the table: ('count','100').
The text file is called count.txt, and any number is written in it.
The static page is named Cnt.htm.
The above 3 files are placed in the same directory.
Since the Access database is used, and it uses non-standard SQL syntax, please pay attention to the need to add square brackets to the table name
and field name: []
The following is from the page Code:
The getCountFromDB method operates on the Access database, and the getCountFromTxt
method operates on txt plain text. Both methods are executed locally.