|
To improve the efficiency of ASP programs, you sometimes need to use SQL server storage technology in ASP. The following is a brief introduction.
Creation of Stored Procedures
Here we will only briefly introduce how to create a stored procedure in the Enterprise Manager of SQL Server:
(1) Open Enterprise Manager
(2) Select a server group (SQL Server group), a server, a database, and a similar database, and right-click the stored procdures item under the corresponding database, in the pop-up menu, select new stored procedure and enter the statement for creating the stored procedure in Stored Procedures properties. The following is an example:
Create procedure proctest @ mycola char (10), @ mycolb char (10), @ mycolc text
Insert into chatdata (mycola, mycolb, mycolc) values (@ mycola, @ mycolb, @ mycolc)
In SQL Server documents, its syntax is:
Create proc [edure] procedure_name [; number] [
{@ Parameter data_type} [varying] [= default] [Output]
[,... N] [With {recompile | Encryption
| Recompile, encryption}] [for replication]
SQL _statement [... n]
If you are not familiar with SQL syntax, you can use check syntax to check the syntax. In the preceding example, the stored procedure named mycola is created and contains three parameters. The data type of the first parameter mycola is Char and the width is 10; the data type of the 2nd parameters is Char, the width is 10, and the Data Type of the 3rd parameters is text. Here, the Data Type of SQL Server is used.
After a stored procedure is created, the following describes how to call the stored procedure in an ASP program: to improve the efficiency of the ASP program, sometimes you need to use SQL server storage technology in ASP. Here is a simple statement to add the parameter P. append cm. in createparameter ("@ mycolc", 250,), the format is:
P. append cm. createparameter ("parameter name", type, direction, size)
The parameter value types are as follows:
NAME value integer function
Addbtimestamp 135 Date and Time Data Type
Addecimal 14 decimal integer
Addouble 5 Double Precision small value
Aderror 10 system error message
Adguid 72 globally unique identifier (globally unique identifier)
Addispath 9 com/OLE Automatic Object (Automation Object)
Adinteger 3 4-byte signed integer
Adiunknown 13 Com/OLE object
Adlongvarbinary 205 large 2-byte value
Adlongvarchar 201 large string value
Adlongvarwchar 203 large unencoded string
Adnumeric 131 decimal integer
Adsingle 4 single precision Floating Point decimal point
Adsmallint 2 2-byte signed integer
Adtinyint 16 1-byte signed integer
Adunsignedbigint 21 8-byte unsigned integer
Adunsignedint 19 4-byte unsigned integer
Adunsignedsmallint 18 2-byte unsigned integer
Adunsignedtinyint 17 1-byte unsigned integer
Aduserdefined 132 user-defined data type
Advariant 12 OLE object
Advarbinary 204 Double Byte variable value
Advarchar 200 character variable value
Advarchar 202 unencoded string variable value
Adwchar 130 unencoded string
The value of the direction is as follows:
NAME value integer function
Adparaminput 1 allows data input to this parameter
Adparamoutput 2 allows data to be output to this parameter
Adparaminputoutput 3 allows data input and output to this parameter.
Adparamreturnvalue 4 allows data to be returned from a subroutine to this parameter
For more detailed resources, see SQL server documentation and IIS documentation resources. |