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