Sunday, October 11, 2009

Build a simple books to inquire a system with Dreamweaver MX

The closest company to make full use of books resource, convenient employee inquires, the decision builds a books to inquire a system on company in-house net. Consider company books is not much, only more than 1000 1, and the characteristic that professional book is in the majority, I decide to make two inquiry requirement: One is according to books the category inquires, the user should choose corresponding category to be able to show all books of this category only, this basically is to face people of pair of company books unfamiliar; The 2nd is according to books the name inquires, the user should input books name only, can search all books that accord with a condition quickly.

Plan already was decided, do with what software namely next reach the issue that how becomes. Here, I chose the form of the webpage, such work in the same placing should open a browser only, inputted corresponding address to be able to inquire. Accordingly, software of Dreamweaver of th e edge tool of my use webpage that make (below abbreviation Dw) , the database uses Acess, the environment is Win98, pws (complier notes: Can consult about the use tutorial of PWS " one of PWS of server of individual of thorough knowledge Microsoft " " understand PWS of Microsoft individual server deep " " understand PWS of Microsoft individual server deep " " understand PWS of Microsoft individual server deep " ) . Below gong of start working of solicit comments type.

Click here to download the source code of this tutorial

Above all, build a database:

   One, A folder is built below my documentation, give a name for " institute " . Of course you also can be built in other place, have other name.

   2, Open Acess, build the one Db1 that occupy a library, build two Zhang Biao Leibie and Tushu, the connection field between watch and watch is " category name " .

Watch Leibie structure is two fields:
(1) category date, text type, field length is 6, fill a field surely, not string of enable input blank;
(2) category name, text type, field length is 20, fill a field surely, not string of enable input blank.

Watch Tushu structure is nine field:
(1) number, text type, field length is 6;
(2) title, text type, field length is 60, fill a field surely, not string of enable input blank.
(3) author, text type, field length is 50;
(4) publisher, text type, field length is 60;
(5) the order in which editions are printed, text type, field length is 15;
(6) monovalent, monetary type, allow decimal digit 2, acquiescent value is 0 yuan;
(7) category name, text type, field length is 20, fill a field surely, not string of enable input blank.
(8) whether to borrow, text type, field length is 4, fill a field surely, not string of enable input blank, acquiescent value is No.
(9) remarks, remarks type.

   3, Input each data according to expressing a structure.

Next, install site and join database:

(1) install a site. Open Dw, choose the New Site below Site menu, pluck a setting site face plate, site name inputs an institute, catalog is the list that we a moment ago built, if pursue 1, the Server Model in Testing Server option chooses Asp VBScript, access chooses Local/Network.

Graph 1

 

(2) build one webpage, because inquiry is dynamic page, because this is playing Dynamic Page of the choice in the face plate that go out and Asp VBScript, if pursue 2. Return a page by Create pushbutton.

Graph 2


(3) join database. Spread out the Application face plate of right, choose Databases label, press "+" button, choose Data Source Name (DSN) , if pursue 3.

Graph 3


(4) playing the face plate of Data Source Name (DSN) that go out to go up (if pursue 4) choice Define. . . Pushbutton enters ODBC data source control implement, choose systematic DSN label, click add pushbutton, choose driver of data of "Driver Do Microsoft Access(*.mdb)" , click the pushbutton that finish.

Graph 4


(5) database route chooses on subsequently face plate (it is the list that we a moment ago built) , pitch on Db1, data source name inputs Db1, if pursue 5.

Graph 5
(6) click affirmatory pushbutton, return ODBC data source control implement face plate. Click affirmatory pushbutton again, return face plate of Data Source Name (DSN) . Click Test pushbutton, if pursue,go out the successful face plate of 6, make clear all Ok, the database has joined, the Databases label of right Application face plate the data source Db1 that with respect to can corresponding occurrence we build.

Graph 6

  Preparative work is ready now, can build trends to inquire a webpage.

   One, Build a homepage. The homepage is very simple, build two inquiry to link namely, "Inquire by books category " catenary receives Chaxun.asp, "Inquire by books name " catenary receives Chaxun1.asp, these two webpages want nether inquiry webpage below us namely. Because the homepage does not need dynamic process designing, can put for Htm format, the file saves institute catalog to fall, entitle Index, specific if pursue 7.

Graph 7

  2, Build inquire a webpage by books category.

1, build one dynamic webpage, name Chaxun.asp.

2, build record volume. Choose the Bindings label in the Application face plate of right, press plus button, choose Recordset(Query) , if pursue 8, shoot a Recordset dialog box, if the setting inside pursues 9, name takes acquiesce to be worth Recordset1, connection chooses the join Db1 that we just build, because show is books category, because this Table chooses watch Leibie.

Graph 8

Graph 9
3, after the setting ends, click Test pushbutton, the content that everybody can see Leibie is expressed is shown completely came. Click OK to return a page, at this moment the inquiry that we can see Binding label lower part shows the name that we just build to be Recordset1.

4, the content that the static state on input webpage shows, if pursue 10, among them " return " catenary receives homepage Index.htm.

Graph 10

5, click the "+" date on the side of Recordset1 of Binding label lower part, develop a field, press with the mouse " category name " the field is not put, in delaying the unit case to the page directly, loose mouse, so unit case included a dynamic text version, if page effect pursues 11.

Graph 11


Just this unit case still can show party only now (everybody can have a look in preexistence browser is such indication effect) , how can you just show all field content so come?

6, pitch on form, choose the Server Behaviors label in the Application face plate of right again, press plus button, choose Repeat Region (circular area) , can control one page to show how many record so. Here, because books category is not much, because this chooses All Records in the dialog box (show all records) , did not divide a page to show, specific if pursue 12.

Graph 12

7, moving Pws, set good way, open this webpage with the browser, seeing screen go up is the category in the database the name is shown came, still just cannot click now go in. Good, we make the page of corresponding indication books below.

   3, Make the page that shows by category inquiry

1, build one dynamic webpage, name Xianshi.asp.

2, build record volume. Choose the Bindings label in Application face plate, press plus button, choose Recordset(Query) , shoot a Recordset dialog box, if the setting inside pursues 13, the name is Recordset2, database watch chooses Tushu, the books information that shows because of the webpage inquires the condition will show before the basis, because this needs to install condition of a limitation to choose,accord with conditional books, so what is this condition to be passed to realize what deliver and accept? This uses URL Parameter with respect to need (URL parameter) , use this parameter to be able to pass inquiry requirement from inquiry webpage, accept this parameter to show the record that accord with in indication webpage next. Specific use means is as follows:

Graph 13
(1) let us return inquiry page Chaxun.asp first. With the field in form of mouse pitch on, choose label of the Server Behaviors on Application face plate again, press plus button, choose Go To Detail Page (to detail page) , shoot a dialog box of Go To Detail Page, if specific setting pursues 14. Detail Page is our indication webpage Xianshi.asp, what input in casing of text of Pass URL Parameter is the parameter name in wanting to deliver detail page through URL, it is facilitating understanding, we are inputted " category name " , this name can want and from the back the parameter name that installs in indication webpage is same. Recordset meaning is record from which deliver in collect go out, we choose Recorset1, column meaning joins numeric source for URL, the inquiry requirement that should go up with inquiry webpage is uniform, because this chooses " category name " , pass Existing Parameters these two option are concerned at expressing sheet, and go up in this inquiry webpage and did not use watch sheet, because this need not be chosen. Click Ok pushbutton, everybody can see the field in form already became to contain dynamic content exceed text to join.

Graph 14

(2) good, URL Parameter already was installed, farewell accepts this parameter now to indication webpage Xianshi.asp. Choose Recordset(Query) , shoot a Recordset dialog box, in Filter setting as above pursues 13, means: The field in inquiring the condition is watch Tushu " category name " should be equal to deliver the URL Parameter parameter that come over " category name " , inquire the webpage rose with respect to connection with indication webpage so.

(3) click Test pushbutton to check. Everybody can input certain category name, dw can show corresponding books to record.

(4) click Ok pushbutton to return a page, record collect to had been built so far.

3, the static content in inputting a webpage, if pursue 15, among them " return " catenary receives inquiry webpage Chaxun.asp, because some category books are more, because this will show,set the page that it is cent to show.

Graph 15

4, with above introductory method, in pulling the field that records part the corresponding position on the page respectively, if pursue 16.

Graph 16

5, the 2nd in pitch on form, click the Server Behaviors label in Application face plate, press plus button, choose Repeat Region, shoot a Repeat Region dialog box, because want to divide a page to show, so the choice shows a few every time, here what I input is 10, the meaning shows 10 records for every page, everybody can be inputted according to circumstance freedom, if pursue 17. Click Ok key to return a page.

Graph 17

6, because be minute of page,show, need turns over a page, so how to come true in Dw? Very simple, everybody first pitch on " home page " , click the Server Behaviors label in Application face plate next, press plus button, can see have option of a Recordset Paging, slip the mouse this option, show next pulling menu, I consider the implication of these menu everybody should understand, if pursue 18. Choose the first " Move To First Record " , shoot a dialog box, if pursue 19, click Ok pushbutton to return a page, such " home page " dynamic link has been done, other " on one page " , " below one page " , " end page " ordinal analogize, had become the dynamic link that answers relatively with its.

Graph 18

Graph 19


7, so how does the user know the record has gone to last, and should break up downward again? Here, such I settlement, if the record already went to last, criterion " below one page " , " end page " conceal automatically on the page, manage together, the record already went to the first, criterion " home page " , " on one page " conceal automatically. Specific implementation method is below:
(1) everybody first pitch on " home page " , click the Server Behaviors label in Application face plate next, press plus button, slip the mouse Show Region option, show next pulling menu, if pursue 20.

Graph 20

(2) choose " Show Region If Not First Record " , the meaning shows to if not be,be recorded the first times, if be the first record,do not show namely conversely, conceal.

(3) playing the dialog box that give to go up to click Ok pushbutton to return a page directly, such " home page " conceal a function automatically to had been done.

(4) manage together, had done other a few conceal a function automatically. "On one page " with " home page " same, choose " Show Region If Not First Record " ; "Below one page " with " end page " same, choose " Show Region If Not Last Record " .
So far, the page that by the category inquiry shows is made eventually finished, we will see material effect. Moving Pws, open Chaxun.asp with IE, click certain category name, be like " new drug drug " , IE can show the books of this category automatically, click " below one page " , "On one page " wait a link a moment, see IE can turn over a page automa tically, if concrete result pursues 21, 22.

Graph 21

Graph 22

  4, Make the webpage that will inquire according to books name

1, build one dynamic webpage, name Chaxun1.asp.

2, the content that the static state on input webpage shows, if pursue 23, among them " return " catenary receives homepage Index.htm, red dotted line shows this is a watch sheet, if the attribute setting that expresses sheet pursues 24, the meaning is Post (deliver) name of a variable that express sheet arrives Xianshi1.asp webpage, carry out this webpage, inquire the webpage passes variable name to be contacted with indication webpage so; Text casing names Ts, this name remembers please, the variable name that because this wants namely,passes through expressing sheet, the indication webpage from the back is used even.

Graph 23

Graph 24

  5, Make the webpage that shows by books name

1, build one dynamic webpage, name Xianshi1.asp.

2, the content that the static state on input webpage shows, if pursue 25, among them " return " catenary receives inquiry page Chaxun1.htm, red dotted line shows this is a watch sheet likewise.

Graph 25

3, build record volume. Choose the Bindings label in Application face plate, press plus button, choose Recordset(Query) , shoot a Recordset dialog box, if the setting inside pursues 26, the name is Recordset1, database watch chooses Tushu, filter filters the condition sets the field in the Tushu that it is a watch " title " want Contains (include) deliver the Form Variable that come over (the variable that express sheet) Ts, this Ts variable inquires the name of casing of the text in webpage Chaxun1.asp namely. Click Ok pushbutton to return a page.

Graph 26

4, in pulling the field that records part the corresponding position on the page respectively.

5, the 2nd of pitch on form, click the Server Behaviors label in Application face plate, press plus button, choose Repeat Region, shoot a Repeat Region dialog box, the setting is show entirely.

If final page effect pursues 27.

Graph 27

So far, the page that by books name inquiry shows is made eventually finished, we will see material effect. Moving Pws, open Chaxun1.asp with IE, input a certain name, be like " quality management " , IE can show all titles automatically to contain " quality management " books, if concrete result pursues 28, 29.

Graph 28

Graph 29

The webpage is made entirely eventually, everybody can move thoroughly now. oneself the IP address of computer tells to work in the same place, open Pws, such colleagues can pass inquiry system to inquire books at any time.

Click here to download the source code of this tutorial

No comments:

Post a Comment