Simple code for ASP to call a stored procedure

Source: Internet
Author: User

In May April, I started to contact SQL2000. I learned how to call the stored procedure. I used to think it was very troublesome. I don't want to learn much about stored procedures. I always think it is difficult for me to have thousands of lines of code. unwilling to learn. work needs. so I found some resources on the network. then I wrote a simple ASP code to call the stored procedure.

<%
Starttime = timer ()
Strconn = "provider = sqloledb.1; Data Source = 'xqf222 '; initial catalog = 'website'; persist Security info = true; user id = 'webuser'; Password = '2016 '; connect timeout = 30"
Set conn = server. Createobject ("ADODB. Connection ")
Conn. Open strconn
If err then response. Write (ERR. description)

Set rs = server. Createobject ("ADODB. recordset ")
SQL = "Exec sp_gettopusername 10"
'Call the Stored Procedure sp_gettopusername to query the userid = 10 member name
Rs. Open SQL, Conn, 3, 3
If Rs. EOF and Rs. bof then
Response. Write ("this record is not found ")
Else
Response. Write (RS ("username "))
End if
Rs. Close
Set rs = nothing
Conn. Close
Set conn = nothing

'Stored Procedure Code is as follows:
Create procedure sp_gettopusername @ userid int output
Select Username
From systemuserlist
Where userid = @ userid
%>

Simple code for ASP to call a stored procedure

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.