Re: 0x800a0cb3 when Update record



Hello Bob,

On Thu, 16 Oct 2008 10:13:51 -0400, Bob Barrows [MVP] wrote:

On Wed, 15 Oct 2008 10:54:45 -0400, Bob Barrows [MVP] wrote:

Anders Eriksson wrote:
By coincident I changed the cursor type from adUseServer to
asUseClient and then the update worked!

I've reset the newsgroup in my client so I now have your original message. I
don't do C++ so bear with me. What I can interpret leads to some questions:
What is the error description? Different providers may have different error
messages for the same error code.
The error message is:
What does the sql variable contain?
The sql variable contains this:

sql.Format(_T("SELECT
ST.OrderNr,ST.Version,ST.Verkstad,ST.Laser,ST.Producerad,ST.Prioritet ")
_T("FROM Orders ST ")
_T("INNER JOIN ")
_T("(SELECT OrderNr,MAX(Version) AS Version ")
_T("FROM Orders GROUP BY OrderNr) ST2 ON ST.OrderNr = ST2.OrderNr AND
ST.Version = ST2.Version ")
_T("WHERE (ST.Laser=%d OR ST.Laser=0 OR ST.Laser IS NULL) AND((NOT
(ST.Producerad=-1)) OR (ST.Producerad IS NULL)) AND (Stoppad=0) AND
(ST.FelKod=0) AND(NOT (ST.Verkstad='MAN')) ")
_T("ORDER BY ST.Prioritet DESC,ST.Tid,ST.OrderIndex"),m_laserId);

Why are you using adCmdUnknown instead of adCmdText?
Just a misstake, I have changed it in my code

You should test the LockType and CursorType properties after opening the
recordset to verify that the provider was able to give you the types you
requested.

I have done that now, CursorType=adOpenForwardOnly and LockType=adReadOnly.
So it has not changed from the default values.

Do I need any specific rights in the database to be able to lock it?

Are you sure you need adLockPessimistic? Most experts advise against using
that lock type except in extreme circumstances. In this case you are using
an explicit transaction, so that lock type is probably not needed at all.

I think I need it ;-) In the database is a queue of orders, I have multiple
programs that work the queue and each program will take the first record
that has not been work on, flag it as working and then continue working
until the record is done. I have tried this with an Optimistic locking but
then I got the same record working in multiple programs.

As to ADO transactions not working with client-side cursors, I believe the
only case where this is true is with RDS, which you are not using.

Aha, You need to read the header also ;-)

However, as Ralph mentioned, you would probably be better off using an
UPDATE sql statement to perform this update rather than a recordset.
I don't get how to create an sql statement that performs an UPDATE as well
as returning a couple of column values within a transaction...

For this project I can live with a client cursor, but since I forsee that
I'm going to need to be able to update a record using server cursor I would
appreciate an answer...

TIA

// 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: ADODB.Recordset.Bookmark
    ... the lock type, ... updatability of the rowset returned by the Source SQL statement, ... to the server -- the latter of which can be confusing. ... I changed the cursor type to static, and bookmarks work, but now I ...
    (microsoft.public.vb.database.ado)
  • Re: reset SQL to reprocess a subfile in an inquiry program(SQLRPGLE)
    ... cursor can be associated with the statement. ... parameter marker values can be supplied with the USING option of OPEN. ... In this way a PREPARE statement is only needed when the string that ... contains the SQL statement gets changed. ...
    (comp.sys.ibm.as400.misc)
  • Re: Problem with MySQL cursor
    ... I have a function that executes a SQL statement with MySQLdb: ... cursor.execute(sql, args) ... just the string interpolation in any playes and the cursor function escapes ...
    (comp.lang.python)
  • Re: Whats wrong?
    ... variables into the SQL statement? ... That way, as the cursor is declared only once, and even if you change the query inside the statement variable, each time you open the cursor the first query will be executed, that's not what I need. ... The USING clause should be specific for opening the cursor with a changed query each time. ...
    (comp.sys.ibm.as400.misc)
  • Re: Whats wrong?
    ... variables into the SQL statement? ... That way, as the cursor is declared only once, and even if you change the query inside the statement variable, each time you open the cursor the first query will be executed, that's not what I need. ... The USING clause should be specific for opening the cursor with a changed query each time. ...
    (comp.sys.ibm.as400.misc)

Quantcast