The relationship and difference between Rs.Open and Conn.execute

Source: Internet
Author: User
Tags object sql
Q: What is the difference between Rs.Open and Rs.execute (Rs is a Recordset object)? In some pages with set Rs=conn.execute () can not be used, some rs.open can not be used

Ask:

What is the difference between Rs.Open and Rs.execute (RS is a Recordset object)? In some pages with set Rs=conn.execute () can not be used, some rs.open can not be used

For:

The first one is that you can have different open cursors
The second cursor with only one forward
And the second you write is not quite correct it should be conn.execute, there is no rs.execute.

REXSP (True water without fragrance ppcode.com):
Sorry, it was written wrong, is set Rs=conn.execute (), if my cursor Conn.cursorlocation=3,set rs=conn.execute () and rs.open what is different?

Conn.execute execution is more efficient, especially in insert into, update and other operations!

There is a difference between the two modes of opening, which is the cursor problem mentioned earlier.

In general, the two are exchanged with each other, but sometimes, for example, you need to take rs.recordcount when you can only open it. I'm not quite sure what the other difference is. I am generally using execute, when I encounter problems with open

Usually Set rs=conn.execute (SQL) or direct rs=conn.execute (SQL)
and Set rs=server.createobject ("ADODB. Recordset ")
Rs.Open sql,conn,0,1 or Rs.Open sql,conn
In this case, open is usually a little bit better than the previous performance.

Use Conn.execute to execute the next set Rs=conn.execute (SQL) directly without shutting down
But the performance speed will be greatly reduced!!
About to slow 2~5 times!! (This is I in the MSSQL cycle 1000 times personally tested, do not believe you immediately test yourself), so execute the next rs=conn.execute before!! Be sure to shut it off! It's a good habit!
Use the RS Rs.Open of a single object before the Open next Recordset, you must require that the display be turned off, otherwise an error, the speed in the case of sql,conn,0,1, the former is basically the same

So I like to use just set a CreateObject ("Adodb.recordset") (without requiring multiple Recordset interleaved operations, multiple also does not matter!)
and use the tail!!! from the beginning.
Open the door and close the door ~~~~~ 咵 tread 咵 ~ ~ ~ ~ ~
Last set rs=nothing, cool!

More important is open to provide very flexible operation of the database metadata of very many attributes!!
Open hundred treasure box, gold Guangcan See what all!
There are many situations in which you have to do it with open!
and conn.execute like black cloth to change the film ~ ~ ~ ~ Very single!!!



Related Article

Alibaba Cloud 10 Year Anniversary

With You, We are Shaping a Digital World, 2009-2019

Learn more >

Apsara Conference 2019

The Rise of Data Intelligence, September 25th - 27th, Hangzhou, China

Learn more >

Alibaba Cloud Free Trial

Learn and experience the power of Alibaba Cloud with a free trial worth $300-1200 USD

Learn more >

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.