Re: ADO - Edit changes multiple records

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance



Hello Bob,

On Tue, 31 Oct 2006 06:49:18 -0500, Bob Barrows [MVP] wrote:

Anders Eriksson wrote:
Hello,



Why use a recordset for a simple update? Does the same problem occur if you
execute this sql without using a recordset?

sql="UPDATE Skylt SET Status= 2 " & _
" WHERE ((OrderNr='17366500000100') AND " & _
"(Version=0) AND (BatchNr='207101000650036') AND (SkyltNr=1)) "

If you're enamoured with using a recordset, you may need to include the key
fields in the column list of the select statement.

The idea is not bad, but since I read the value of the two colums just
before updating I assume that it makes a bit more sense to use the already
open recordset.

I just tried to change the CursorLocation from adUseClient to adUseServer,
and now the error is gone.

I don't really know when to use Client resp Server, but I will try this for
a while and see it everything works

Thanks for the answer!


// Anders
--
English is not my first, or second, language
so anything strange, or insulting, is due to
the translation.
Please correct me so I may improve my English!
.



Relevant Pages

  • Re: UPDATE query in Access 2003 raising error
    ... The only reason I questioned the recordset is that you could conceivably ... the SQL looks fine to me. ... Set qdfTemp = db.CreateQueryDef ... Elsewhere in the code I use the same technique to execute an SQL statement ...
    (microsoft.public.access.formscoding)
  • Re: [Microsoft][ODBC Microsoft Access Driver] Syntax error in INSERT I
    ... This statement causes ADO to create a recordset to receive the results ... of the query being executed and assign that recordset to your qryAddProj ... You should use the ExecuteOptions argument of the Execute ... string containing a sql statement to be executed. ...
    (microsoft.public.data.ado)
  • Re: ADODB.Recordset: Operation is not allowed when the object is closed
    ... > ' Create the ADO Connection and Recordset objects. ... > ' Set the connection string, open the connection and execute the ... If your sql string is an insert/update/delete statement, ...
    (microsoft.public.scripting.vbscript)
  • Re: insert Q
    ... many sql statements on the page). ... When you use a connection's Execute method, a Command object is ... Always use an explicit recordset object: ...
    (microsoft.public.inetserver.asp.db)
  • Re: insert Q
    ... >> conn.execute SQL ... When you use a connection's Execute method, a Command object is ... Always use an explicit recordset object: ...
    (microsoft.public.inetserver.asp.db)