Wrox Home  
Search P2P Archive for: Go

  Return to Index  

asp_databases thread: Getting values for a single row from Command parameters


Message #1 by "J House" <jesse@s...> on Thu, 23 Aug 2001 17:23:19
I am trying to retrieve a single row of data from using the command 

parameters with the direction adParamOutput,

This code is not throwing any errors but I don't get the data.

I thought is was possible to get the data for a single row without using a 

recordset, am I wrong?



<%



iNewsID = Request("NewsID")

if iNewsID = "" then

	iNewsID = 0 ' no error - send something

end if



set oConn = server.CreateObject ("ADODB.connection")

set oCmd = server.CreateObject ("ADODB.command")

oConn.Open (Application("TestString"))



sSql = "news_item"



with oCmd

	.ActiveConnection = oConn

	.CommandText = sSql

	.CommandType = adCmdStoredProc

	.Parameters.Append oCmd.CreateParameter ("NewsID", adInteger, 

adParamInput, 4)

	.Parameters("NewsID").Value = iNewsID

	set oParam = .CreateParameter ("Headline", adVarChar, 

adParamOutput, 50)

  .Parameters.Append oParam

	set oParam = .CreateParameter ("Brief", adVarChar, adParamOutput, 

4000)

  .Parameters.Append oParam

	set oParam = .CreateParameter ("PublishDate", adDate, 

adParamOutput, 8)

  .Parameters.Append oParam

	set oParam = .CreateParameter ("Category", adInteger, 

adParamOutput, 4)

  .Parameters.Append oParam

	set oParam = .CreateParameter ("Body", adLongVarChar, 

adParamOutput, 32000)

  .Parameters.Append oParam

  .Execute 

end with



sHeadline = oCmd.Parameters("Headline").Value 

sBrief = oCmd.Parameters ("Brief").Value 

dPublishDate = oCmd.Parameters ("PublishDate").Value 



set oCmd = nothing

oConn.Close 

set oConn = nothing





with response

	.Write "headline: " & sHeadline & "<BR>"

	.Write "brief: " & sBrief & "<BR>"

	.Write "pubdate: " & dPublishDate & "<BR>"

end with

%>

  Return to Index