Re: Lookup executes 3 time upon Recordset.Save
- From: "Julian Madle" <julian@xxxxxxxxxxxxxxxx>
- Date: Tue, 31 Jan 2006 11:22:52 +0100
Finally found the problem after wasting around 5 hours. The problem occurs
because the recordset is using a server side cursor, I have switched to a
client side cursor and the SQL is now only executed once.
The performance hit of using a client side cursor is much less than
executing my code three times (the code below is simplified fro
demonstration purposes, my actual SQL creates a temp table, selects data
into from a join of around ten tables, paginates and returns the result,
drops the temp table, and finally stores some usage stats).
I have learnt from this problem that one must be VERY careful to check
performance issues when using Recordset.Save
Julian
"Julian Madle" <julian@xxxxxxxxxxxxxxxx> wrote in message
news:uBArxraJGHA.2064@xxxxxxxxxxxxxxxxxxxxxxx
> Getting really strange problem using Recordset.Save: my SQL command gets
> executed three times (tested on SQL Server 2000 and 2005 using both
> sqloledb
> and {SQL Server} drivers):
>
> Set objConn = Server.CreateObject("ADODB.Connection")
> objConn.Open("Driver={SQL Server}; Server=localhost; Database=DBname; User
> ID=Username; Password='password'")
> Set RS = objConn.Execute("SET NOCOUNT ON; SELECT ID FROM Products; INSERT
> INTO DebugLog (Message) VALUES ('Done'); SET NOCOUNT OFF")
> RS.Save "c:\output.xml", 1
> Set RS = Nothing
> objConn.Close
> Set objConn = Nothing
>
> When executed (once) there will be three 'Done' messages in the table
> named
> DebugLog. This does not occur when the (exetremly simplified) SQL is
> executed directly inside SQL Server, or when RS.Save is not called. This
> looks like a bug in ADO to me.
>
> Can anybody confirm this behaviour and more importantly suggest a
> solution/workaround?
>
>
> Thanks
> Julian
>
.
- References:
- Lookup executes 3 time upon Recordset.Save
- From: Julian Madle
- Lookup executes 3 time upon Recordset.Save
- Prev by Date: Re: VS.2005 c# Autonumber via Access with @@IDENTITY Failing
- Previous by thread: Lookup executes 3 time upon Recordset.Save
- Next by thread: Re: Using SQL to create user defined table & column names
- Index(es):
Relevant Pages
- Re: Millions of Delete Statements
... You mention a cursor. ... Others have mentioned batching the commands,
... so I will throw out one that is less good (executing them ... get the whole
SQL statement I don't know of another way to do it). ... (comp.databases.ms-sqlserver) - Re: Daten schnell lesen =?ISO-8859-1?Q?=28Gegenst=FCck_zu_BU?= =?ISO-8859-1?Q?LK_INS
... Damit meinte ich eine direkte Verarbeitung mittels ... 10maligem FETCH (näheres
findest Du unter DECLARE CURSOR). ... Ein DataReader in einer SQL Server Assembly
ist ... Anweisungen auf dem Server erledigt werden kann. ... (microsoft.public.de.sqlserver) - RE: OLE DB Provider - how tell to not use cursor internally for jo
... from server to client. ... me under SQL 2000 error, because DBE OLE
provider use cursor for join tables. ... Under SQL 7.0 it run well, the cursor isn't
use for join tables. ... (microsoft.public.sqlserver.programming) - Re: SQL Server 2005 cursor incompatibility issue, will not update through adodb recordset
... SQL Instance name is the same as the machine name. ... I think I caused the
problem by renaming the machine after installing ... The application is trying to update
through a cursor ... and an SQL Server ODBC and receives this error each time it
tries to ... (microsoft.public.sqlserver) - Re: Cursors - Server Side - Only Forward?
... You're using VB's ADO.Recordset object to manipulate the cursor data. ... Using
server side cursors would ... > Dim Dbs As New ADODB.Connection ... >
' Prepare SQL Select statement ... (microsoft.public.sqlserver.programming)