Curious about which performs better.

Results 1 to 2 of 2

Thread: Curious about which performs better.

  1. #1
    JB Guest

    Default Curious about which performs better.

    Hi,<BR><BR>Assuming that the stored procedure is only inserting the First Name and Last Name into the Data Store, which of the following statements is the better performing ASP code?<BR><BR>In other words, should I use the ADODB.Command or ADODB.Connection to perform this INSERT?<BR><BR>These both perform the same thing. However, using the Connection.Execute seems to call three things, the .Open the .Execute and the .Close<BR><BR>It would seem to me that the first is quicker because of this. Am I wrong?<BR><BR>You help is greatly appreciated. Thanks - JB<BR><BR>&#039;FIRST CODE EXAMPLE<BR>Set objCoMM = Server.CreateObject("ADODB.Command")<BR><BR> objCoMM.ActiveConnection = strConnString<BR> objCoMM.CommandText = "SP_NewAccountInsertBasics"<BR> objCoMM.CommandType = adCmdStoredProc<BR> objCoMM.Parameters.Append objCoMM.CreateParameter("@FName", adVarChar, adParamInput, 75, strFName)<BR> objCoMM.Parameters.Append objCoMM.CreateParameter("@LName", adVarChar, adParamInput, 75, strLName)<BR> objCoMM.Execute<BR><BR>Set objCoMM = Nothing<BR><BR><BR>&#039;SECOND CODE EXAMPLE<BR>strSQL = "SP_NewAccountInsertBasics &#039;" & strFName & "&#039;, "<BR>strSQL = strSQL & "&#039;" & strLName & "&#039;"<BR><BR> Set objConn = Server.CreateObject("ADODB.Connection")<BR> objConn.Open(strConnString)<BR> objConn.Execute(strSQL)<BR><BR>objConn.Close<BR>Se t objConn = Nothing

  2. #2
    Join Date
    Dec 1969

    Default RE: Curious about which performs better.

    there&#039;s really not that much in it - a command is implicitly created when you use the connection method anyway..<BR><BR>j

Posting Permissions

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