Dreamweaver MX 2004 ASP Program

Source: Internet
Author: User
Tags empty final connect sql string first row variable dreamweaver
Dreamweaver| Program recently Forum and QQ people always ask, "I want to learn ASP but do not know where to learn?" Are there any introductory tutorials? ", in fact, there have been a lot of this site on the ASP tutorial and there are related books to provide you download, may not see the reason it?" From today I write a tutorial to teach you step-by-step learning ASP, here we use the visual language programming tools Dreamweaver MX 2004来 Implementation of the development of ASP program, in the future I will be introduced to you how to develop ASP.net, php,jsp. This tutorial is simple to write, it should be easier to get started, everyone follow one step after the line. My operating system is win XP, so the screenshots are all XP interfaces.

1, turn on the computer, set up a folder under E-Disk myweb(this clip is your site storage point), and built several subfolders inside (like the subdirectory of your site)

2, back to the root directory of MyWeb , right to choose "Sharing and Security"(in fact, to create a virtual directory quickly)

3, after the Properties dialog box, select the " Web Sharing" tab, click "shared Folder", the Sharing Alias dialog box, choose the silent Settings , OK .

4, the supplementary explanation. Setting up a Web share is actually setting up a virtual directory for IIS. You can see that the default Web site in IIS already has MyWeb(Note: My OS is WinXP, in fact, about the operation of IIS.) such as: WinXP inside open Control Panel-Administrative Tools-internet Information Services---Local computer---default site) (Note: For the installation of IIS under XP see:XP install IIS5.1 video tutorial )

5, the above steps completed the establishment of the station, set up a virtual directory, the following is the Dreamweaver MX 2004 opened. The first step is to "manage the site"

6, select "define the site", in the Pop-up property box select "Advanced" tab, from "Classification" first select "Local Information", the right window set the site name (casually input, but you should be aware of the meaning of their representatives, Recommend the same root file name as your site), the local root folder (this time to point to the folder we built in step 1).

7, then set the remote information, access to select "local/Network", the remote folder still select our site folder e:\myweb\

8, then "test Server","server model" for the interim ASP Javascript, "Access" local/network,"test server Folder" is still our site folder e:\ myweb\, "URL prefix" is added to MyWeb after http://localhost , which is the virtual directory we set up in step 3.

9, at this time, the site definition is basically finished, click OK. The Edit Site dialog box appears,complete .

10, at this time DW's Site property box will be e:\myweb\ all the content map over, in this need to remind is: Dreamweaver MX 2004 built a site connection, you can directly in the DW of its corresponding file, folder operation, It's best not to go back to my Computer d:\myweb\ . "Be able to operate in the DW, try not to leave the DW's editing environment."

1, first confirmed that the site root directory has a special database storage directory, such as E:\myweb the following Databases folder (there is OK, no new). I'm using Microsoft Access 2003.

Then open Microsoft Access, "file"---"new", then select an empty database , and in the pop-up dialog box, select the store path and name it.

2, in the new database "Create a table using the designer", pop-up "Table 1" in the design of your related fields, pay attention to their "data type", but also important: field ID, type AutoNumber, and select it as the primary key .

3, after the design of "Table 1" , directly close the window, in the pop-up dialog box click "Yes" to save "Table 1", and renamed to user.

At this point you need to mention that the setting of the field ID that you just emphasized is necessary, otherwise the following dialog box will appear after the save, and the effect is to set the type to be the key field for AutoNumber.

4, this time the database table user has been established.

5, double-click the database table user, small Tim Try, in the pop-up user table input related content. Close save.

At this point the database, table, field, the establishment of the save work finished. Here we start using Dreamweaver to manipulate the MDB file.

1, open Dreamweaver MX 2004, in the site to create a new asp page (index.asp), select the New project "ASP Javascript." Open the Application panel and select the Database tab in the Applications panel. As soon as we set up the site in front, we chose the document type (that is, the ASP JavaScript we chose) and tested the server (http://localhost/myweb/). Now click on the "+" number and select "Custom connection string".

2, in the bounce out of the "Custom connection string" dialog box,"Connection name" casually write one. The "connection string" should be filled out properly. Driver={microsoft Access Driver (*.mdb)};d Bq=e:\myweb\database\webjxcom.mdb. This is common in hand-written ASP connection database code (related articles see http://www.webjx.com/htmldata/2005-03-24/1111596140.html)

Click on "Test"to show success.

If the connection is unsuccessful, you can open the Dreamweaver help to view the relevant instructions.

3, successfully connected to the database, in the DW is actually automatically generated a connection file. The location in the auto-generated Connections folder, the name you just made in the "Custom connection string" is simply knocking on the named ASP file . You can also notice that the various fields within the MDB file are visible within the DW Database tab.

4, connect the database file is there, but below our specific individual page how and database connection? Select the Bindings tab and add the recordset (query ). Just to see the literal meaning is to come to the SQL query statement.

5, in the pop-up "Recordset" window,"name" casually write a bar, also can not write, the default. But " connection" is going to select the connection object you defined from the Drop-down list, andthe "table" continues to drop the selection (note: This is related to several tables when designing the database).

6, other casual look, in fact, the most important thing is automatically generated SQL statements , click "Advanced ...", you can see the following figure


7, click OK , you will find that the recordset has been bound, all the fields in the database appear.

Notice the Insert button below, and you can select a field, or press the button or drag it to the Index.asp page. The ASP page displays the contents of the database. But only the first row, to show all .... Next

8,"Insert" menu-->> "Application Object"-->> "Dynamic Data"-->> "Dynamic Table". The following figure:

9, pop-up dynamic table to select the set of records that have been set, showing a few records to understand that is the generation of paging program: Data records more, more content, on several pages to display, a few pages. Records are automatically generated by using a table, and then set the properties of the table.

When you click OK , the effect is as follows:

10, then we can press F12 to view the effect, of course, if you are familiar with the HTML code and CSS, then you can format the table to make it look more beautiful! The final effect is as follows:

So far you've learned how to connect the database, how to display the records in the library table. Waiting for you is the following how to insert new records, how to modify records, delete records, and so on. Please continue to follow the following tutorials!


1, open Dreamweaver MX 2004, in the site to create a new asp page (index.asp), select the New project "ASP Javascript." Open the Application panel and select the Database tab in the Applications panel. As soon as we set up the site in front, we chose the document type (that is, the ASP JavaScript we chose) and tested the server (http://localhost/myweb/). Now click on the "+" number and select "Custom connection string".

2, in the bounce out of the "Custom connection string" dialog box,"Connection name" casually write one. The "connection string" should be filled out properly. Driver={microsoft Access Driver (*.mdb)};d Bq=e:\myweb\database\webjxcom.mdb. This is common in hand-written ASP connection database code (related articles see http://www.webjx.com/htmldata/2005-03-24/1111596140.html)

Click on "Test"to show success.

If the connection is unsuccessful, you can open the Dreamweaver help to view the relevant instructions.

3, successfully connected to the database, in the DW is actually automatically generated a connection file. The location in the auto-generated Connections folder, the name you just made in the "Custom connection string" is simply knocking on the named ASP file . You can also notice that the various fields within the MDB file are visible within the DW Database tab.

4, connect the database file is there, but below our specific individual page how and database connection? Select the Bindings tab and add the recordset (query ). Just to see the literal meaning is to come to the SQL query statement.

5, in the pop-up "Recordset" window,"name" casually write a bar, also can not write, the default. But " connection" is going to select the connection object you defined from the Drop-down list, andthe "table" continues to drop the selection (note: This is related to several tables when designing the database).

6, other casual look, in fact, the most important thing is automatically generated SQL statements , click "Advanced ...", you can see the following figure


7, click OK , you will find that the recordset has been bound, all the fields in the database appear.

Notice the Insert button below, and you can select a field, or press the button or drag it to the Index.asp page. The ASP page displays the contents of the database. But only the first row, to show all .... Next

8,"Insert" menu-->> "Application Object"-->> "Dynamic Data"-->> "Dynamic Table". The following figure:

9, pop-up dynamic table to select the set of records that have been set, showing a few records to understand that is the generation of paging program: Data records more, more content, on several pages to display, a few pages. Records are automatically generated by using a table, and then set the properties of the table.

When you click OK , the effect is as follows:

10, then we can press F12 to view the effect, of course, if you are familiar with the HTML code and CSS, then you can format the table to make it look more beautiful! The final effect is as follows:

So far you've learned how to connect the database, how to display the records in the library table. Waiting for you is the following how to insert new records, how to modify records, delete records, and so on. Please continue to follow the following tutorials!

1, in the site to create a new file register.asp to do the registration page, Select the new project "ASP Javascript." Again, because the file conn.aspwas previously built and connected to the database, the file is valid throughout the site. So in your new regist.asp " app"----"database" tab automatically has "conn". This step is to start with the first step, not to be added later (unless you want to connect to another database).

2, then switch to the "bindings" panel, add the recordset, the steps and the same here no longer detailed description. The following figure:

Note: In the above figure there is a "simple ..." button, which is to achieve the above two graphics switch!

3, in the regist.asp page make a very simple form page, content and form table Single-name best and Datasheet table of the field corresponding. The following figure:

code for the corresponding form:

<form name= "Form1" method= "Post" action= "" >
<table width= "339" border= "1" cellspacing= "2" cellpadding= "2" >
<tr>
&LT;TD width= > Username:</td>
&LT;TD width= "204" ><input name= "name"Type=" text "id=" name ></td>
</tr>
<tr>
<td> Password:</td>
<td><input name= " Pass"Type=" text "id=" pass "></td>
</tr>
<tr>
<td> e-Mail:</td>
<td><input name= "Email"Type=" text "id=" email "></td>
</tr>
<tr>
<td> password hint problem:</td>
<td><input name= "question"Type=" text "id=" question "></td>
</tr>
<tr>
<td> Password Prompt answer:</td>
<td><input name= "Answer"Type=" text "id=" Answer "></td>
</tr>
<tr>
<td>OICQ:</td>
<td><input name= "Oicq"Type=" text "id=" Oicq "></td>
</tr>
<tr>
<td>ICQ:</td>
<td><input name= "ICQ"Type=" text "id=" ICQ ></td>
</tr>
<tr>
<td>MSN:</td>
<td><input name= "MSN"Type=" text "id=" MSN ></td>
</tr>
<tr>
<td>URL:</td>
<td><input name= "URL"Type=" text "id=" url "></td>
</tr>
<tr align= "Right" >
&LT;TD colspan= "2" ><input type= "Submission" name= "submit" value= "submitted" >
<input type= "reset" name= "Submit2" value= "reset" ></td>
</tr>
</table>
</form>

5, switch to the server Behaviors panel, because the recordset was previously bound in step 2nd, so there is also a recordset in the label content, which is normal. But we want to insert the record, continue to press "+", select "Insert Record".

6, in the pop-up "Insert Record" dialog box. The "Connection" is chosen by you; " insert into the table" Let it be; " after inserting, go to" means to jump to a page after the success of the prompt, write first, but remember to build this page immediately; "Get value from" is the name of the form you just selected; Inform elements , name is inserted in column name, meaning that the contents of the name input box in the form are inserted into the database table name field.

At this point understand why in step 3 "content and form table single-name the best and database tables and fields corresponding to the", DW automatic intelligent insertion, otherwise you have to choose one point.



7, after the determination, the registration system has been completed in half. (My normal time is less than 1 minutes, the main is a lot of practice) but again think of the registration system is not allowed to duplicate it? It's going to continue to add some content.

In server behavior , continue to press +, and select "Check new user name"inuser authentication .

8, also in the pop-up "check new user Name" dialog box, the User name section select "name" means not to register, of course, can also choose other, such as email, meaning that the same email can only register one. " if it exists, go to" to indicate what to do if there is a repetition of the phenomenon? Then jump to an error page (registbad.htm) prompt. Of course, this page has not been built, first write a document, and just as register.htm Remember to fill up immediately.

9, do some details of the action, such as the form inside which must add ah, which must be a number ah, email address to include a @ and two "." No, wait a minute. Note Select the Submit button first. In the design panel behavior , select Detect form. The pop-up dialog box can be easily set to click on the




10, then do not have just two pages:regist.htm and registbad.htm (as for these two pages I will not be established!) )

regist.htm page content is probably "register successfully, please login "(of course, the login system is the next one I want to write).

registbad.html page content is probably "Oh, sorry, have this user, or trouble you re-register." Return! "

  Also note that the "password hint problem" and "password hint answer" also fill in, later on "Retrieve the password system" will be used.

Register the system to this, the main is to insert records, and verify the effect of the duplicate.


 1. In the site of the right key to create a new file login.asp used to do login page; Similarly, previously had built and database connection file conn.asp. So in the panel "application"----"database" label inside automatically have "conn".

2. As with the registration page, you need to go to the "+" Recordset under the Bindings tab of the application panel. Click " Test " When you have finished selecting in the pop-up window to see the relevant records in the current database that meet the SQL conditions.

  3. A form form is made on the login page, and the input text box is properly named.

Form-related code:

<form name= "Form1" method= "Post" action= "" >
<p>
User name:
<input name= "user" type= "text" id= "user" >
</p>
<p> Password:
<input name= "Pass" type= "text" id= "pass" >
</p>
<p>
<input type= "Submit" name= "Submission" value= "submitted" >
<input type= "reset" name= "Submit2" value= "reset" >
</p>
</form>

4. The form label in the dot selects the entire sheet.

5. Select "+"----"User authentication"----"Log on user" in the "Server Behavior" in the Applications panel.

6. Pop-up dialog box to make specific settings. Get input from form means to select a specific Form1 form from this ASP page, as well as the required user name and password fields in the form.

Connection verification indicates that connection settings are made through conn files and database tables. Select the user table, which lists the names of users and passwords in the database for a specific username and password field. It is obvious that the contents of the fields in the library and the content submitted in the form are validated compared to the connection.

"Login successful, go to" loginok.asp, the page is a permission page, only when the login is completely correct to enter. Otherwise login failed, go to loginbad.html.

7. After the determination, the Login.asp is basically completed. Switch to Login.asp's code window, note! The user's local variable session has been generated: "Session (" mm_username ") = Mm_valusername;". This variable can be used throughout the station.

8. Save the file, create a new loginok.asp file, this is a protection page, only when the user password correctly logged in will not enter. Otherwise jump to loginbad.html (login failed, possibly because of a user name or password wrong.) To open loginok.asp, application---bind---stage variable.

9. Pop-up stage Variable dialog box, according to the 7th step of the code display, the name input mm_username sentence can be. Represents a direct reference to the session ("mm_username") = Mm_valusername.

10. Select the established "Mm_username", press the "Insert" button or drag it into the page. Allows different users to dynamically display their corresponding names when they enter.

11. Again for loginok.asp to do permissions, meaning you can know http://localhost/newgn/loginok.asp, but you simply input in the address bar is absolutely not in, or the user password is not correct can not enter. How to achieve this effect? The server behavior --- authentication ---" Restrict access to pages " is OK.




12, according to " username and password " to limit, refused to jump to "loginbad.html."

13. The basic setup of the loginok.asp is complete. There's a loginbad.html to try again. Very simple, Login failed to jump to the page, illegal login also jumped to this page, the content is very simple.

The specific method of production is no longer described in detail! It's very simple!


1. Set up the first page search.asp, its main role is to find the password of a friend to enter their user name, very simple page: a name text input box, and a Submit button.

2.search.asp Select Form tag, in the corresponding property box, "Action" fill in Search1.asp, "method" using post.

3. Save Search.asp, create a new search1.asp inside the site, and open it. This page has two functions:

1, to determine the previous page, that is, search.asp fill in the name of the database exists.
2, there is no error should be prompted, the existence should be the user's problem (question) field content display. How to achieve it concretely?

The database on the 4.search1.asp has been well connected. In the old way, first bind the recordset (Application panel--Under the Bindings tab, "+" "Recordset (Query)"). In the pop-up "Recordset" will be well set. The main thing is "filter", select "Name" = "form variable" "name". It means that to display the contents of the field name in a database table, there is a condition: The Name form content written from the previous page (search.asp) is equal to the field name value in the library.

5. Switching to "advanced" can be seen automatically generated SQL code, which has Requeset.form ("name"), meaning that the 1.asp text box entered the value received.

6. In the search1.asp page of the user does not exist in the prompt language "This user has not registered, so you do not need to find the password." "

Line break and then the statement in which the user exists. But at the same time also pay attention to the problem of the password display, as well as the answer to a text box.

7. Select search1.asp Form label, the action in the property panel to fill in the search2.asp, the method uses post. Search2.asp is mainly used to determine whether the problem and the answer is consistent, if the match will display the correct password. Attention! Is the question and the answer together. And we are only the answer can pass through, then our problem how to spread to search2.asp?



8. After the "Your password question is:" Insert the cursor and then select "Question" from the "Recordset" in "binding" or drag it directly into the page. Attention! This is also only displayed to the user password problem, it is not possible to pass this information past. How can that be?

9. We use "hidden fields" to transmit question values. Inserts a "hidden field".

Modify the properties of the hidden fields: "Hide Area" name is called "Question" bar, "value" click on the Lightning icon behind, pop-up dialog box select "Question". The assignment to the hidden field question has been completed and can also be passed.

10. The rest is to strictly separate the two parts of the search1.asp. Select "This user has not yet registered, so you do not need to find the password." "The text of this paragraph. The application panel "server behavior" + "show area" record is blank displays the area. In the pop-up dialog box, select the Recordset1 you just created. The meaning is obvious: if the recordset that satisfies the SQL language query is not found, the line error prompt is displayed.

11. Similarly, select Form forms, the Application panel server behavior "+" show area "record is not empty, display the area." In the pop-up dialog box, select the Recordset1 you just created. The meaning is also clear: if there is a recordset that satisfies the SQL language query, the question and answer writing box is displayed. The final effect page should read as follows:

Finally, the search1.asp is finished. In summary, this page mainly plays a role in the connecting link. First to determine if there is no this user, if there is, and the password problem displayed, and to be able to transfer to the next page search2.asp

12. The search2.asp is going to judge the password problem that search1.asp over and whether the answer is consistent with the database. Also has two function: does not match, the explanation password answer is wrong, returns the previous page to come again! Match, that is to give people the code, hehe. But with the experience of doing search1.asp, do search2.asp is not a piece of cake!

13. Save Search1.asp, create a new search2.asp at the site and open it. The usual, bound recordset (application panel--Under the Bindings tab "+" "Recordset (Query)"). It's worth paying attention to in the pop-up recordset. Filter, select "Question" = "form variable" "Question"

14. But have you noticed that we are going to send two values to search2.asp to accept, but now only one to choose from. So what should we do? Switch to the related code for advanced SQL. We're going to add it slightly. SQL structure Query language will be a little, the ability to imitate a little stronger, hehe came over! "Variable" adds a "Mmanswer", "Run value" of course is "Request.Form" ("Answer") "and then add the SQL language and answer = ' mmanswer ' read the meaning of SQL to understand: must require question and answer match the values of the two fields in the database table.

15, then like to do search1.asp-like quick design search2.asp, the page written on the letter does not match the statement "Your question is not the answer, or go back and try again?" "And when selected, the same is the application panel server behavior" + "show area" record is empty show area.

Then there is the match, "Your password is:" After, from the "Binding" "Recordset" select "PWD" insert or directly dragged into the page;

And also select this section, the Application panel server behavior "+ Show area" record is not empty displays the area.

The whole process of production completed! You can test it yourself!



Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.