Dreamweaver How to modify code when writing ASP?

Source: Internet
Author: User

First of all to sober up a little, what talent can be modified.

One, I can only modify their own; second, the administrator can modify everyone's.

(The order is: first confirm is the correct login, then your own data appears, then you can modify, right.) )

This loginok.asp page is still in the bar. It doesn't matter if it's not there. Do it again as an exercise. All right, now. Loginok.asp is mainly a personal information page, different users display different information.

This page should note: It is a protection page, to add "restricted access to the page", of course, I believe you have done.

Then it's the record, come on!

Steps/Methods

Loginok.asp The Application Panel Bindings tab "+" Recordset.

Pop-up dialog box, well set down! The main is to filter that block: "name" "=" "Stage variable" "Mm_username".

Switching to advanced ... actually generates the Sql:select * from user WHERE name= ' Mmcolparam ', and Mmcolparam is a variable that is assigned a session ("Mm_username") value at run time.

Well understood, the loginok.asp is bound and the record to be displayed has one condition: just press where to find it.

You can't find it! Because only if the session ("Mm_username") does not exist can not be found.

And if the session ("Mm_username") does not exist that means the guy is not logged in properly.

Oh, a bit like chicken and egg problem.

In fact, this time you just select "Application"-"Update record form" can make our changes.

But the personal feeling, first does not use this, uses other methods equally can, and also can learn more knowledge. Why?

Below, then follow me. And let you learn to make the master Detail page.

About the Master Detail page, as the name suggests. First, a general display (main), to which interested, often come to a "details please enter."

Of course it's not very useful in this page, because the Lord comes to you with a user information.

But what if it's the admin page? A specific view of this user will be used.

In the dialog box that pops up, "Recordset" Recordset1, "home field" means the field information to display on the main page.

Because it is the Lord, other fields that do not appear will be "-" deleted, and the Lord has only a name left.

The following connection to the details will only choose "name".

"Pass a unique key" to choose the AutoNumber ID Bar, of course, the other can also choose, but be sure to confirm that you selected in the database table must have content. For example, some people register when QQ number does not necessarily write, then you can not choose OICQ as "pass unique key"

(The so-called "pass a unique key", is the ASP passed URL parameter values.) You don't see the xxx URL is http://www.cnbruce.com/blog/showlog.asp?cat_id=27&log_id=219, that "?" What is behind the thing, cat_id is the parameter, 27 is the value, of course, not only a parameter behind, a number of parameters on the & connected. Of course, these things, learn the ASP know. DW do, oh, do not understand so much, but you must learn. )

Then "detailed page name", because has not done, of course, recommended you do not do, why? It's a mystery!

Let's name a "xiangxi.asp" first.

"Detail page field" will not change it. OK, sure.

After certain, a period of time waiting, suddenly found that DW automatically generated xingxi.asp (just the mystery where). Not only is the page content generated, the recordset is also bound, and dynamic text is added. (Really thoughtful service)

And look at the loginok.asp. There are a lot of things, see Eyes daze, these are mostly connected with xiangxi.asp for connection, not rubbish, no fear, hehe.

Then what do you do? Go back to xiangxi.asp. We need to revise the information, so I need some text to fill in. Then there is a way to die, first select the entire table, ctrl+x the table to cut. Immediately return to the Form tool section, insert the form, and Ctrl + V paste it in the Out dotted box.

Next, add the text box. Delete {recordset1.xxx} One after the other, leaving only an ID and name because these two do not need to be modified and cannot be modified!

For the rest, change to the corresponding text box, and note that the "text field" has the corresponding name.

Add two buttons to the table by adding one row.

To think again, those text box is not empty, the normal change of information will also display to the original information. So, select the form. The corresponding field in the application binding recordset.

Alternatively, use the properties of the text box to set the initial value, click the Dynamic Lightning icon, and select the corresponding field in the pop-up dialog box.

When you are done, select form forms ... "Application"--"Server Behavior"--"+"--"update record"

Pop-up window, general default. After the update, go to: "The old rules first write a xiugaiok.html, later to build."

Of course, the page is not finished yet, to add "server behavior"-"User Authentication"-"Restrict access to pages", primarily protected and not accessible.

Finally in the xiugaiok.html done, the general content: Modify success! Return to loginok.asp.

Basically finished, you can debug it. Let's start with the loginok.asp. Because it is the first time to open the window, there is no login at all, so loginok.asp back to loginbad.html automatically

Go back to Login.asp and fill it all the way down

Click "Cnbruce" to modify the password "789" OK!

Then, you go back to Login.asp to see if the change password is effective!

Attention matters

The whole page of modification is getting more and more complicated, with a lot of steps here and, of course, the usefulness of the master Detail page. The most important thing is that this is a challenge for beginners, flexible use, expansion, modification, refinement, need to practice more. It is normal to have errors, you need to know and correct the wrong, only in this way, perhaps the technology will improve.

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.