[Oracle-ASP]Store Procedure 사용하기
2004. 9. 22. 08:35ㆍ일 이야기
Stored Procedure 을 이용한 단일값 반환
<% Option Explicit %>
<!--METADATA TYPE= "typelib" NAME= "ADODB Type Library" FILE="C:Program FilesCommon FilesSYSTEMADOmsado15.dll" -->
<%
Dim objCon
Dim strConnection
Set objCon = Server.CreateObject("ADODB.Connection")
strConnection = "Provider=SQLOLEDB;Data Source = 서버명;Initial Catalog = DB명;User id=아이디; Password= 비밀번호;"
objConn.Open strConnection
Dim objCmd
Set objCmd = Server.CreateObject("ADODB.Command")
With objCmd
.ActiveConnection = objCon
.CommandText = "sp_Example"
.CommandType = adCmdStoredProc
.Parameters.Append .CreateParameter ("inValue", adVarChar, adParamInput, 1)
.Parameters.Append .CreateParameter ("outValue", adInteger, adParamOutput, 0)
.Parameters("inValue") = 0
.Execute , , adExecuteNoRecords
Dim intResult
intResult = .Parameters("@intResult")
End With
Response.Write intResult
Set objCmd = Nothing
objCon.Close
Set objCon = Nothing
%>
<% Option Explicit %>
<!--METADATA TYPE= "typelib" NAME= "ADODB Type Library" FILE="C:Program FilesCommon FilesSYSTEMADOmsado15.dll" -->
<%
Dim objCon
Dim strConnection
Set objCon = Server.CreateObject("ADODB.Connection")
strConnection = "Provider=SQLOLEDB;Data Source = 서버명;Initial Catalog = DB명;User id=아이디; Password= 비밀번호;"
objConn.Open strConnection
Dim objCmd
Set objCmd = Server.CreateObject("ADODB.Command")
With objCmd
.ActiveConnection = objCon
.CommandText = "sp_Example"
.CommandType = adCmdStoredProc
.Parameters.Append .CreateParameter ("inValue", adVarChar, adParamInput, 1)
.Parameters.Append .CreateParameter ("outValue", adInteger, adParamOutput, 0)
.Parameters("inValue") = 0
.Execute , , adExecuteNoRecords
Dim intResult
intResult = .Parameters("@intResult")
End With
Response.Write intResult
Set objCmd = Nothing
objCon.Close
Set objCon = Nothing
%>