1: SELECT statement in ASP 1: SELECT statement

zhaozj2021-02-16  53

The five-flowers of SQL products have to live, perhaps you don't have to open your sleeves. But if you want to use ASP and SQL, you may be dizzy. MySQL, SQL Server and MSQL are excellent SQL tools, but unfortunately, in the ASP environment you can't use them to create a practical SQL statement. However, you can use the Access knowledge and the corresponding Access skills, plus our tips and techniques, I believe you can successfully add SQL in your ASP page.

In the world of SQL, the most basic operation is the SELECT statement. Many people will be familiar with the following operations directly under the database tool:

Select What

From whichtable

WHERE CRITERIA

Executing the above statement will create a query that stores its results.

On the ASP page file, you can also adopt the above general grammar, but the situation is slightly different, when the ASP programming, the content of the SELECT statement is derived as a string:

SQL = "SELECT What from Whichtable Where Criteria"

Ok, I understand the way the SQL "talk" under the ASP, so that you can make your needs, the traditional SQL query mode and conditional query can be used.

For example, you may wish to assume that there is a data table in your database, the name is Products, now you want to take out all the records in this table. Then you have written the following code:

SQL = "SELECT * from Products"

The above code - the role of the SQL statement is to take all the data in the table - all records within the data table will be selected. However, if you just want to take a particular column from the table, such as p_name. Then you can't use * wildcard, you have to type the name of a particular column, the code is as follows:

SQL = "SELECT P_NAME FROM PRODUCTS"

After performing the above query, the contents of the P_Name column will be selected.

转载请注明原文地址:https://www.9cbs.com/read-21409.html

New Post(0)