select| statements |select a wide variety of SQL products, you may have done it sooner than others. But you can get dizzy if you want to use both ASP and SQL at the same time. MySQL, SQL Server, and msql are excellent SQL tools, but unfortunately you don't need them to create a useful SQL statement in an ASP environment. However, you can take advantage of your knowledge of access and the corresponding access skills, plus our tips and tricks, and believe that you will be able to successfully add SQL to your ASP pages.
In the SQL world, the most fundamental operation is the SELECT statement. When using SQL directly under Database Tools, many people will be familiar with the following: SELECT what
From whichtable
WHERE criteria
Executing the above statement creates a query that holds its results.
In the ASP page file, you can also use the above general syntax, but the situation is slightly different, ASP programming, the contents of the SELECT statement to be assigned as a string to a variable: SQL = "Select what from whichtable WHERE criteria"
OK, understand the ASP under the SQL "speak" way, then follow the same pattern, as long as you meet your needs, the traditional SQL query mode and conditional query can be useful.
For example, suppose you have a data table in your database, the name is products, and now you want to take out all the records in the list. Then you write the following code:
SQL = "SELECT * FROM Products"
The function of the above code--SQL statement is to take out all the data in the table--after execution, all the records in the datasheet will be selected. However, if you only want to remove a specific column from the table, such as P_name. Then you can't use the * wildcard character, you have to type the name of a specific column, the code is as follows:
SQL = "Select P_name from Products"
After executing the above query, the contents of the Products table and the P_name column will be all selected.