4,578,516 th visitor since 2017.2.1 ( Today : 116 )
Programming
No. 445
Name. swindler
Subject. Oracle Stored Procedure 호출 (커서타입)
Main Cate. ASP
Sub Cate.
Date. 2008-04-27 15:18
Hit. 3434 (203.248.117.3)
File. sp_cursor.png   
Function testhome( loginId, loginPassword, db_helper )

Const CONNECT = "Provider=MSDAORA.1;Data Source=;User ID=;Password="


Dim cn, rs, cmd, param
Dim SQL

set cn = Server.CreateObject( "ADODB.Connection" )
cn.Open CONNECT

SQL = "{call PG_USER.SP_LOGIN_CHECK(?,?,{resultset 0, P_REFCURSOR}, ?)}"
set cmd = server.CreateObject ("ADODB.Command")
with cmd
set .ActiveConnection = cn
.CommandText = SQL
.CommandType = 1 'adCmdText
'Pass in 0 to retrieve all of the records
set param = .CreateParameter("V_USER_ID", adVariant , 1 , , "user") '<<131=adNumeric, 1=adParamInput
.Parameters.Append param
set param = .CreateParameter("V_PASSWD" , adVariant , 1 , , "1111") '<<131=adNumeric, 1=adParamInput
.Parameters.Append param
set param = .CreateParameter("V_RETURN" , adNumeric , 2 , , mLoginResultNum) '<<131=adNumeric, 1=adParamInput
.Parameters.Append param
end with

set rs = server.CreateObject ( "ADODB.Recordset" )
set rs = cmd.execute

response.write cmd.Parameters("V_RETURN")


%>
<TABLE WIDTH="80%" ALIGN=center BORDER=1 CELLSPACING=3 CELLPADDING=3>
<%
Response.Write ("<TR bgcolor=Gray>")
For i = 0 To rs.Fields.Count - 1
Response.Write ("<TD>" & rs.Fields(i).Name & "</TD>")
Next
Response.Write ("</TR>")
Do until rs.EOF
response.write ("<TR>")
for i = 0 to rs.Fields.Count - 1
If IsNull(rs(i).value) then
Response.Write ("<TD> NULL </TD>")
else
Response.Write ("<TD>" & rs(i).value & "</TD>")
end if
next
rs.MoveNext
response.write ("</TR>")
loop
%>
</TABLE>
<%
Set cmd = Nothing
Set param = Nothing
rs.close
Set rs = Nothing
cn.close
Set cn = Nothing
End Function


[바로가기 링크] : http://coolx.net/cboard/develop/445



Name
Password
Comment
Copyright © 1999-2017, swindler. All rights reserved. 367,611 visitor ( 1999.1.8-2004.5.26 ), 2,405,771 ( -2017.01.31)

  2HLAB   2HLAB_Blog   RedToolBox   Omil   Omil_Blog