Access to | data | Database Access database (1)
ASP advanced Application--Access database
Hello everybody, I am Sunwen, from Wuhan Huazhong Normal University, now, I want to tell you how to use ASP operation database. Before reading this tutorial, you must have a certain understanding of ASP programming. The database part is the ASP programming key and the difficulty, many books have introduced, but the author thought that their introduction all is not easy to understand, the language is more blunt. As a result, many of the friends who are learning ASP have taken the database as a stumbling block to the following learning. And many network predecessors write ASP tutorials, mostly relatively simple, for beginners, when talking about the database when a pen, so many ASP programmers at a loss. Now, I use the simplest version, with my experience in ASP database development, to tell you how to use ASP to operate the database. In addition, my e-mail is: mrfat@china.com, if you have any questions, please contact me.
Before you talk about this tutorial, it is necessary to introduce the environment in which this tutorial is run. That is pwin98+pws+access2000, and assume that you have installed the PWS, and set the permissions. Before you proceed to the tutorial, first install Microsoft ACCESS2000, after installing ACCESS2000, the driver will automatically install, open Control Panel---->ODBC data source, as shown in the following illustration:
The example used in this tutorial is Db2.mdb, which you can click to download.
With the database, the next step is to configure the ODBC database source. The purpose of setting up a data source is to indicate to the system exactly where the database is and what database drivers it uses so that all users can easily access the database, what we call a common database. First open the Control Panel--->ODBC the data source, and click System DSN (data source Names, datasource name) as shown in the figure:
Click the Add button
Select Microsoft Access Driver (*.mdb) and click Finish.
Above we do one thing, the purpose of this thing is to tell the system we have such a database, and to the system to explain the location of the database, and with the system for this data source has a name, called MyDB. In the future when we want to use the Db2.mdb database in an ASP statement, just tell the system mydb that name, and then the system will find the database based on the settings we just made and use the access driver we just set up when we open the database. That's where we set up the data source, and that's why we're doing the work ahead.
When you finish your first lesson, you may have a lot of friends to ask. I'm using the ISP's server and how I have the opportunity to set these things up. Don't worry, I have a way to talk about the purpose of the above operation, just want to know how DSN works, and to lay the groundwork for the following courses. In the next lesson, I'll introduce a way to open a database directly without DSN, and, of course, that code will be longer than this one. Good bye!