Monday, October 5, 2009

The use of method of the database in Dreamweaver

Linking a database is the first condition that our program develops, we see the use craftsmanship of method of the database in Dreamweaver below.

One, the database file that does not recommend address of method of use Server.Mappath(opposite documentation)

Although have platform transplanting sex, but to disparate arrangement of ideas, the adduction below different deepness the file of this database, the validity that cannot assure database method thoroughly.

Cite a case:

1, database file Cnbruce.mdb, place folder Database(but Http visit)

2, the Conn.asp of join database file that DW generates automatically, be in folder Connections

3, if be in DW,test join method succeeds, must input an address to be Server.Mappath(" . . / Database/cnbruce.mdb" )

But cite subsequently file of this database connective must maintain presence in some folder, this folder and Database are equal

Namely:

- Database

- Cnbruce.mdb

- Connections

- Conn.asp

- some folder

- X1.asp

It is normal that ability of this kind of structure is used. But this must ask the site is medium, all adduction the file of join database file, must deposit the one class catalog in the site to fall. Apparent this is unreasonable, for instance such structure.

- X2.asp

- Database

- Cnbruce.mdb

- Connections

- Conn.asp

- some folder

- some child folder

- X3.asp

Criterion X2.asp and X3.asp all cannot show normally.

Principle analysis: Mi 踓 Onn.asp is put where, no matter the content of Conn.asp how, finally is to depend on cited the position of the file position of the file of Conn.asp and database affects.

Settle way: Undertake judging current method in 赾 Onn.asp, according to different level the value gives out different link method... to abecedarian, troublesome.

2, the database file that does not recommend way of catalog of use Server.Mappath(opposite root)

Use this kind of method, need to adjust IIS acquiescent site current DW site to be in folder above all (XP system) , or build a site to point to this folder (the systematic) such as 2K.

Anyway a word, input Http://localhost/ when you namely when, indication content already was not acquiescent IIS home page, however the documentation of acquiescent home page in the DW site folder that you install.

So after installing this IIS site

1, database file Cnbruce.mdb, place folder Database(but Http visit)

2, the Conn.asp of join database file that DW generates automatically, be in folder Connections

3, if be in DW,test join method succeeds, input an address to be Server.Mappath("/database/cnbruce.mdb" )

/ Database/cnbruce.mdb this method is opposite root catalog, obtain of type of operate from a strategically advantageous position into what linage occupies library method, of wh whichever administrative levels, the site documentation below which catalog all can show normally.

But still do not recommend! The reason is as follows:

In this locality you can revise the site of IIS by oneself, when uploading server or fictitious lead plane, the trouble came.

1, if your fictitious lead plane serves trade technology,close nevertheless, should be in analytic of catalog of your website root when, not be the site folder that points to you, point to server system however dish the Wwwroot folder below. Then method affirms a mistake.

2, the site root catalog that if you need,those who upload is not you, very apparent, method also can produce analytic mistake for certain.

So, do not recommend! So, how should do?

3, recommend use Server.Mappath(this locality the database file of absolutely physics method)

Very simple, this database the place that in this locality you always can know to it is in. Use address of this absolutely physics method directly when be founded in DW.

OK, will upload. Impossible of course so artful:

So, need to obtain the database document that uploads server space to go up only now, be to be in what physics address to go on the server.

How to obtain?

1, build file of a Path.asp, content is very simple

2, this file and database file Cnbruce.mdb, in all one folder, bind type to upload together.

3, Path.asp is examined in URL address column, the physical address that gets Cnbruce.mdb go up in the server, copy this method.

4, the physical method in the Conn.asp this locality, after replacing, upload again. All OK!

Characteristic:

1, although platform transplanting is very not strong, but join of the file in supporting all sites in the round, besides namely between this locality and server both the transplanting between.

2, prevent %5c cruel library to obtain database address secondhand.

3, more and more space proposals put database document now in putting blame Web to visit catalog (specific of course ways and means is obtained is additionally one kind of method) , this must ask the user uses physical method.

So, my viewpoint is:

Dreamweaver MX trends establishs the use method of station database method:

No comments:

Post a Comment