ASP Quick Start, fast out of the program!

Source: Internet
Author: User
I have been working for a year, learned the ASP, PHP, I am a professional metal heat treatment graduate, in the school did not do, and then graduated in the Internet Café one months can not bear to go home self-study ASP, according to the book learned three months, just reluctantly wrote a chat room program. Later in the company to learn PHP, only in one weeks to get started, the Oriental Self-Help station has a few small errors to fix, but also wrote a simple list of self-help sites. I summed up, the reason why I learned that PHP can have this speed is because I directly contact the program (of course, and the basis of ASP is inseparable), so I think the best way to quickly start ASP is to look at the program.


ASP and HTM compared to the most important is the operation of the database, so the quick start from the operational database:


first set up a Db1.mdb Access database, a table info, two field IDs (automatic growth), name (character) (the method does not say, and word almost, is very simple).


Establish a database connection, connections/conn0.asp


<%


Dbq=server. MapPath ("./db1.mdb") ' Get database absolute path


constr= "Driver={microsoft Access driver (*.mdb)};d bq=" &DBQ "Set database connection string


set Conn=server. CreateObject ("ADODB.") Connection ") ' establishes the Connection object


conn.open constr ' Open connection


%>


Add data adddata.asp:


<% @LANGUAGE = "VBSCRIPT" codepage= "936"%>


<!--#include file= "connections/conn0.asp"-->


<html>


<head>


<meta http-equiv= "Content-type" content= "text/html; charset=gb2312 ">


<title> Add Data </title>


</head>


<%


if request. Form ("names") <> "" Then


Names=server. HTMLEncode (Request. Form ("names")) ' can simply prevent scripting intrusion: <script language= "JavaScript" >while (1) {alert ("^_^")}</script>


sql= "INSERT into info (name) VALUES (' &names& ')"


' response. Write (SQL)


Conn.execute SQL


Response. Write ("Add success!") <br> continue <a href=adddata.asp> add </a> or <a href=showdata0.asp> view </a>. ")


End If


%>


<body>


<form name= "Form1" method= "Post" action= "" >


<input name= "names" type= "text" id= "names" >


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.