Muliple Queries in same ASP and Command.Execute

Results 1 to 7 of 7

Thread: Muliple Queries in same ASP and Command.Execute

  1. #1
    Sam Otto Guest

    Default Muliple Queries in same ASP and Command.Execute

    Frequently, I have ASP&#039s that do a couple of queries. Currently, I do this by creating one RecordSet, opening and closing it for each query. If I change over to use Command.Execute, which returns a record set, I will be slowing down the execution of my page since each Execute will have to create a new RecordSet, right?

  2. #2
    John Harvey Guest

    Default RE: Muliple Queries in same ASP and Command.Execute

    Do you mean instead of using<BR>SQL = "SELECT * FROM TABLE1"<BR>RSet.Open (SQL, Conn)<BR>...<BR>RSet.Close<BR>SQL = "SELECT * FROM TABLE2"<BR>RSet.Open (SQL, Conn)<BR>...<BR>You would use <BR>SQL = "SELECT * FROM TABLE1"<BR>Set RSet = Conn.Execute(SQL)<BR>...<BR>SQL = "SELECT * FROM TABLE2"<BR>Set RSet = Conn.Execute(SQL)<BR><BR>Unless you had a good reason for it, I would not do it this way. I&#039m sure it would be slower, and it&#039s not as clean an implementation, in my opinion.<BR>Regards,<BR>John Harvey<BR>

  3. #3
    Sam Otto Guest

    Default RE: Muliple Queries in same ASP and Command.Execute

    Yea, I thought it would be slower, the problem is I want to make my first query a stored procedure that needs a parm. The only way to set this up and call it is using the Command object right? Since I will be using a Command object on the first query I though I would use it for other queries. I realize I could reuse the RecordSet from the first query but what if my second query is a Stored Procedure that needs a parm...

  4. #4
    John Harvey Guest

    Default Command objects and SQL

    I&#039m not really sure if a stored procedure can be accessed by SQL, but I would tend to think it can. I would try this:<BR>Created the command object, then try viewing it as runtime text and see if you can find the SQL statement it uses (if it uses one...)<BR>Regards,<BR>John Harvey

  5. #5
    Carl Brothers Guest

    Default RE: Command objects and SQL

    To send parameters to the SP, you definitely need to use the ADO command object. I have used a conn.execute(SP_Name) to access stored procedures W/O parameters. <BR><BR>RE: using many conn.execute() statements. I have done this on numerous web apps and have not noticed any slowdown at all. ALWAYS Remember to close your objects and set them to nothing.

  6. #6
    Join Date
    Dec 1969

    Default RE: Command objects and SQL

    May I know which is faster, con.execute or<BR><BR>Thank you.

  7. #7
    Sam Otto Guest

    Default RE: Command objects and SQL

    That&#039s kind of my question to. I think conn.execute is slower because it has to create a recordset object. With, you have already created the recordset. Obviously, this doesn&#039t matter for a single query but for multiple ones, reusing the recordset would be a big advantage. The problem is if you have multiple queries and they all are SP&#039s that take parameters, you must use command.execute and therefore create a new recordset object every time!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts