Two ways to store procedure calls in ASP, and comparison without stored procedures

xiaoxiao2021-03-06  100

I have written a simple message with SQL Server and ASP. In the constant attempt, discover that the page is displayed, and some differences are different. The following is compared to the time comparison of several ways. First, use the stored procedure paging, this situation is divided into two ways: the first, use the Command object, as follows: set cmd = server.createObject ("adoDb.command") cmd.activeconnection = conncmd.commandtext = "ycuu_GB_GETMSG "cmd.CommandType = 4'adCmdStoredProccmd.prepared = true'set param = Cmd.CreateParameter (" @ iPageNo ", adInteger, 1,2, Page) Cmd.Parameters.Append paramset param = Cmd.CreateParameter (" @ iPageSize ", Adinteger, 1, 2, PageSizeConst) cmd.parameters.Append paramset = cmd.execute second 2. Do not use the stored procedure, use the adoDb.recordset function to page, the specific code is as follows: SET RS = Server.createObject ("AdoDb.Recordset") SQL = "Select * from guestbook Order by DateAndTime Desc" RS. Open SQL, CONN, 1, 1RS.PAGESIZE = 150 'The number of messages displayed per page, total = rs.recordcountmypagesize = rs.pagesizers.absolute = Page To more significantly display the speed, I add the number of messages displayed per page Big to 150 (in fact, there is certainly no such big value). As for the configuration of my machine, I will not say that it is mainly compared.

It was found that the time of execution is as follows: The first type: stabilizes between 0.1953125 seconds to 0.210,9375 seconds, the average value is probably: 0.20 seconds second: stable between 0.1716875 seconds to 0.1857 seconds, the average value is: 0.177 The third of the second: stabilizes between 0.4375 seconds to 0.4632 seconds, the average value is about 0.45 seconds, but when the number of records read is 20, the results are as follows: found that the time of execution is as follows: first Type: Stable between .0390625 seconds to .0546875 seconds, the average value is probably: 0.045 seconds second: stable between 0.046875 seconds to .0546875 seconds, the average value is probably: 0.050 seconds, third: stabilizes. Between 09375 seconds to 0.1015625 seconds, the average is probably: 0.97 seconds, it seems that conn.execute and command.execute seems to be different, while the former's call mode seems to be simpler. At the same time, it can be seen here that the speed of storage process of paging is indeed a lot more faster than the Paging speed of Recordset. PS: The younger brother issued a text, hey, I found a good hard, I will work hard. I hope that everyone will bear to write bad this time. By the way, I still want to ask you Heroes CONN.EXECUTE and COMMAND.EXECUTE these two ways in these two ways, huh, because I found the latter in this way to perform stored procedures. I don't know why I don't need to be as simple as in front. Author Blog:

http://blog.9cbs.net/beerfroth/

转载请注明原文地址:https://www.9cbs.com/read-125585.html

New Post(0)