¾È±Ô °øºÎ¹æ

ACTIVE SERVER PAGE > Command - Parameter

µî·ÏÀÏ : 2017-07-04 17:06 Á¶È¸¼ö : 52,449

Parameters Ä÷º¼ÇÀº Command °³Ã¼ÀÇ Parameter °³Ã¼µéÀ» Æ÷ÇÔÇÏ°í ÀÖ´Â Ä÷º¼ÇÀÔ´Ï´Ù.
Parameters Ä÷º¼ÇÀº ÀúÀåÇÁ·Î½ÃÁ® ¶Ç´Â ÁúÀÇ¿¡ ´ëÇÑ ¸Å°³º¯¼ö¸¦ Àü´ÞÇÒ¶§ ÁÖ·Î »ç¿ëµÇ´Â °³Ã¼ÀÔ´Ï´Ù.
Parameters °³Ã¼´Â append ¸Þ¼­µå¸¦ »ç¿ëÇؼ­ Parameters Ä÷º¼Ç¿¡ Ãß°¡µË´Ï´Ù.
 
¸Å°³º¯¼ö¸¦ Àü´ÞÇÏ´Â ¹æ¹ý¿¡´Â Command °³Ã¼ÀÇ Parameters Ä÷º¼ÇÀ» »ç¿ëÇÏ´Â ¹æ¹ý°ú Excute ¸Þ¼­µåÀÇ
µÎ¹ø° Àμö·Î ¹è¿­°ªÀ» ÁöÁ¤Çؼ­ ¸Å°³º¯¼ö¸¦ ³Ñ°ÜÁÖ´Â ¹æ¹ýÀÌ ÀÖ½À´Ï´Ù.

°£´ÜÇÑ ÇÁ·Î½ÃÁ®¸¦ º¸¸é,,,,
 
	
	CREATE proc main_news_list2
	 	@category1_code varchar(20),
		@category2_count int OUTPUT
	as
   	begin
   		select @category2_count = count(category2_code) from category2 where category1_code = @category1_code
   	end



Ä«¿îÅ͸¦ °¡Áö°í ¿À´Â ¿¹Á¦Àä. asp ÇÁ·Î±×·¡¹ÖÀ» º¸°Ú½À´Ï´Ù.
 
<!--METADATA TYPE="typelib" NAME="ADODB Type Library" File="C:\Program Files\Common Files       				System\ado\msado15.dll" -->
	
	strName = "2"

	Dim objCon
	Dim strConnection
	Set objCnn = Server.CreateObject("ADODB.Connection")

	strConnect="Provider=sqloledb;Data Source=xxx.xxx.xxx.xxx;Initial Catalog=xxx;User ID=sa;Password=xx;" 
	objCnn.Open strConnect 

	Dim objCmd
	Set objCmd = Server.CreateObject("ADODB.Command")

	with objCmd
		ActiveConnection = objCnn
		.CommandText = "main_news_list2"
		.CommandType = adCmdStoredProc

		.Parameters.Append .CreateParameter("@category1_code",advarchar,adParamInput,20)
		.Parameters.Append .CreateParameter("@category2_count",adInteger,adParamOutput,0)
                          
		.Parameters("@category1_code") = strName
              
		.Execute , , adExecuteNoRecords

		CNT = .Parameters("@category2_count")

	End with      
	%>
	
	·¹ÄÚµå °¹¼ö : <%=CNT%>



À§ÀÇ ¿¹Á¦´Â category1_code °ªÀ» ³Ñ°Ü¼­ count ¸¦ °¡Áö°í ¿À´Â ¿¹Á¦ ÀÔ´Ï´Ù.
strName °ªÀ» ÀÔ·ÂÇؼ­ @category2_count °ªÀ» °¡Áö°í ¿É´Ï´Ù.
 
¡Ø Ȥ½Ã µµ¿òÀÌ µÇ¼Ì´Ù¸é ´ñ±Û¿¡ ÇѸ¶µð ³²°ÜÁÖ¼¼¿ä!
ÀÛ¼ºÀÚ   ºñ¹Ð¹øÈ£
ÀÚµ¿±Û ¹æÁö     (ÀÚµ¿±Û ¹æÁö ±â´ÉÀÔ´Ï´Ù.)
³»¿ë   ´ñ±Û´Þ±â 
À̸ÞÀÏ ¹®ÀÇ : cak0280@nate.com  
Copyright 2000 By ENTERSOFT.KR All Rights Reserved.