Wrox Home  
Search P2P Archive for: Go

  Return to Index  

asp_components thread: ADO Stored Procedure Calls


Message #1 by drmiller@a... on Thu, 21 Sep 2000 15:31:34 +0100
I have repetitive code (such as that below) sprinkled many times within

WSC and VB components and I wonder how to best handle this repetitve code

for performance purposes (and not necessarily efficient coding)?



Should I...

1) spell/type out the complete code each time it is needed?

2) write a Function within each component and call that function (e.g.

getRS(strSPName,intID)returning a recordset?

3) capsulize the code and include it as another class in the same dll for

a VB component?

4) capsulize the code in an entirely new component and use that component

for data access?



I'm interested not only in performance but also efficient interaction with

COM+.



Thanks for any insight if you've already figured this out.





dim objCmd,rs

set objCmd = Server.CreateObject("ADODB.Command")

with objCmd

  .ActiveConnection = strConnect

  .CommandType = adCmdStoredProc

  .CommandText = "sp_StoredProcedure"

  .Parameters.Append objCmd.CreateParameter("ID", adInteger, adParamInput)

  .Parameters("ID") = ptID

end with

set rs = objCmd.Execute


  Return to Index