ASP implementation of SQL Server database fuzzy query

Source: Internet
Author: User
Introduction to ASP and its ADO components
---- ASP (Active Server Pages) is a Server-side scripting language that can be considered as a combination of Html, scripts, and CGI (Universal Gateway Interface. However, it is more confidential than Html, more flexible than scripts, and more efficient than CGI.
---- The ASP program extension is ". ASP ", which can contain Html statements, ASP commands, text, and all other descriptive languages (such as VBScripts and JavaScripts) that can be embedded in Htnk documents ). The ASP command must be located between the symbols "<%" and "%>" defined by ASP. When a user accesses an ASP webpage, the Web server first parses and executes ASP commands between "<%" and "%>" and then returns the result to the user, so that the user cannot see the ASP source file. This is why ASP is highly confidential.
---- ASP has built-in ADO components, so it can easily access various databases.
ADO is the latest technology provided by Microsoft to developers to access databases on webpages. The ADO component mainly includes seven objects including the Connection object, Command object, Parameter object, RecordSet object, Field object, Property object, Error object, Fields data set, Properties data set, Parameters data set, errors data set and other four data sets.
---- The Connection object is responsible for connecting to the data source (database or text file;
---- The Command object transmits the specified SQL Command;
---- The Parameter object provides the SQL Command parameters required by the Command object;
---- The RecordSet object is used to browse and operate the data retrieved from the data source;
---- The Field object specifies the specific fields of The RecordSet object.
---- This is a few objects closely related to database access.
Fuzzy query of SQL Server databases
---- The Select query command of the SQL Server database can be used to query the database. You can use the "LIKE" keyword and "%" wildcard in the Where clause of the Select command to perform fuzzy queries. The following statement finds all records whose Name field value contains the "Smith" string in the authors table of the pubs database.
Use pubs
Select * From authors
Where Name LIKE "% Smith %"
GO
---- The SQL Server database also provides a database object called Stored Procedure (Stored Procedure). You can store some common command processes as Stored procedures, to run these stored procedures, you only need to enter the name of the stored procedure. This not only simplifies operations, but also improves efficiency (the running of stored procedures is much more efficient than running commands one by one ). The selection of stored procedure names should comply with the naming rules of SQL Server. When it starts with "#", it indicates a temporary stored procedure. It only exists when the application is running and the program ends, automatically deleted.
---- The following statement creates a temporary stored procedure named # query:
Create Procedure # Query
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.