First: create a simple stored procedure:
create procedure viewdata
as
begin
select uname from users
end
Then, run it in the query analyzer. In the database stored procedure, there is an additional viewdata
and use ASP to call it:
The CONN file (connecting to the database) is as follows:
<%
set db=server.createobject("adodb.connection")
db.Open ("driver={SQL Server};server=192.168.18.254;uid=sa;pwd=;database=it;")
%>
192.168.18.254 is the IP address of the SQL SERVER server, uid pwd it is the user and password for connecting to the database and the database to be connected.
Create a new index.asp file with the following content:
<!--#include file="conn. asp" -->
<%
set rs=server.createobject("adodb.recordset")
sql = "execute viewdata"
rs.open sql,db,3,2
response.write rs.recordcount&"<br>"
while not rs.eof
response.write rs("uname")&"<br>"
rs.movenext
wend
response.End
%>