The following example shows how to access a student information table:
First, create the access database file student. mdb, open the Table Designer, enter the field name and data type, and set the primary key:
Second, establish test data:
Student
Num |
Name |
Age |
Fromw |
School |
Major |
Score |
200706001 |
Zhang Fei |
19 |
Jilin Province |
Jilin University |
Linguistics |
388 |
200706002 |
Liu Bei |
20 |
Jilin Province |
Northeast Normal University |
Japanese |
328 |
200706003 |
Guan Yu |
19 |
Beijing |
Peking University |
Computer Software and Theory |
421 |
200706004 |
Mink Zen |
18 |
Sichuan |
Sichuan University |
Electronic Information Engineering |
376 |
200706005 |
Guan Hanqing |
18 |
Zhejiang |
Zhejiang University |
Computational Mathematics |
375 |
200706006 |
Qu Yi |
20 |
Zhejiang |
Zhejiang University |
Application chemistry |
402 |
200706007 |
Oman |
19 |
Beijing |
Peking University |
Library Management |
314 |
200706008 |
Abei |
19 |
Beijing |
Beijing University of Aeronautics and Astronautics |
Thermal Energy and Power Engineering |
348 |
200706009 |
Wu Zetian |
19 |
Shanghai |
Fudan University |
European and American Literature |
399 |
200706010 |
Liu Yunlong |
18 |
Liaoning |
Shenyang Industrial University |
Mechanical Manufacturing |
416 |
200706011 |
Fangge |
19 |
Liaoning |
Dalian University of Technology |
Applied Mathematics |
333 |
200706012 |
Wang da |
21 |
Tianjin |
Tianjin University |
Network applications |
342 |
200706013 |
Xi Shi |
18 |
Tianjin |
Nankai University |
Data Warehouse |
411 |
200706014 |
Li Shimin |
18 |
Jilin Province |
Changchun University of Technology |
Information Management and Information System |
364 |
200706015 |
Wang Mang |
19 |
Hubei Province |
Wuhan University |
Solar energy |
294 |
200706016 |
Zhu Yuanzhang |
18 |
Hubei Province |
Wuhan University |
Geothermal energy |
352 |
200706017 |
Zhuge Liang |
19 |
Beijing |
Tsinghua University |
Data Mining Technology |
434 |
200706018 |
Shida |
20 |
Beijing |
Beijing University of Science and Technology |
Energy Machine Engineering |
319 |
200706019 |
Hongfeng candle |
18 |
Beijing |
Beijing International Studies University |
Foreign Language Culture |
347 |
200706020 |
Liu Yan |
18 |
Heilongjiang |
Harbin Institute of Technology |
Electrical Engineering and automation |
405 |
Place student. db in the D: root directory.
Create and configure the Data source: the data source name is student.
Then, create a Student file directory in the path 5.5webapps of apache (the most popular WEB server platform on Unix) Software Foundationomcat (a very useful JSP running platform, in addition, compile the jsp (preferred for SUN Enterprise Applications) file code in this directory:
<%... @ Page contentType = "text/html; charset = gb2312" language = "java" import = "java. SQL. *, java. io. *" %>