How to use ASP stored procedures

Source: Internet
Author: User
1. Use the Command object and Parameter object to pass parameters
This document describes how to use the Microsoft SQL Server7.0 database to create a connection file AdoSQL7.asp for backup.
<% 'Adosql7. asp
Option Explicit
Response. Expires = 0

'Part 1: establish a connection
Dim Cnn, StrCnn
Set Cnn = Server. CreateObject ("ADODB. Connection ")
StrCnn = "Provider = sqloledb; User ID = sa; Password =; Initial Catalog = pubs; Data Source = ICBCZJP"
Cnn. Open StrCnn
%>
Note: Set Data Source to the name of the machine where your database server is located.
In addition, in the past, Microsoft Access97 was used to conveniently view fields and data, while SQL Server databases were not used on database servers, when debugging ASP scripts on another machine, you need to install another tool to view the fields and data. Here we provide you with a tool: Msqry32.exe (Microsoft Query ), this file is installed with Office97 and is generally located under the Microsoft Office Directory.
For example, wuf70.asp:
<% @ LANGUAGE = "VBSCRIPT" %>
<! -- # Include file = "AdoSQL7.asp" -->
<! -- # Include file = "adovbs. inc" -->
<% 'Wuf70.asp
Dim release test, prmTest, rsTest
'Create Command object
Set Release test = Server. CreateObject ("ADODB. Command ")
'Recordset and Command objects can all be connected to the Connection object through the ActiveConnection attribute.
Using test. ActiveConnection = Cnn
'SQL command-contains two parameters. Use? Indicates
Export test. CommandText = "Update jobs Set job_desc =? Where job_id =? "
'Set command type to SQL statement
Export test. CommandType = ad1_text
The 'prepared attribute determines whether to compile the SQL command first and set it to True to accelerate the running.
Required test. Prepared = True

'Create a Parameter object
Set prmTest = Route test. CreateParameter ("job_desc", adVarChar, adParamInput, 50, "Network ")
'Append the data to the Parameters dataset.
Using test. Parameters. Append prmTest

Set prmTest = Route test. CreateParameter ("job_id", adSmallInt, adParamInput, "12 ")
Using test. Parameters. Append prmTest

'Modify? You do not need to return results. Simply use export test. Execute.
Related Article

E-Commerce Solutions

Leverage the same tools powering the Alibaba Ecosystem

Learn more >

11.11 Big Sale for Cloud

Get Unbeatable Offers with up to 90% Off,Oct.24-Nov.13 (UTC+8)

Get It Now >

Alibaba Cloud Free Trial

Learn and experience the power of Alibaba Cloud with a free trial worth $300-1200 USD

Learn more >

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.