Re: 0x800a0cb3 when Update record



Anders Eriksson wrote:
On Thu, 16 Oct 2008 13:00:50 -0400, Bob Barrows [MVP] wrote:

No, I had to take the phone and when that was done I didn't remember
that I hadn't entered the error message and just sent it.
The error message is:
"Unknown error 0x800A0CB3"

Damn! not much different from blank, is it.



The sql variable contains the sql statements that are in the Format.
Since I'm lazy I didn't remove the _T( but it should be clear what
the SQL statement are...


Yes, in this case, while I wouldn't describe it as "clear" to a non-C++
coder, it was decipherable. However, if you had been concatenating variable
values into it, I would have been just as much in the dark.

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.

That means you have asked for incompatible settings. I really see
nothing that should lead to that incompatability. Where's Bill
Vaughn when you need him?
Maybe the join is the problem after all ... I'm just guessing here.
You may want to play with the "Unique Table" dynamic property of the
recordset object. I've never had to use it myself (preferring to use
DML for data modifications rather than recordsets) but there is
documentation for it.


I have now tested a bit more and there seem to be something really
strange going on.
When I set CursorLocation=adUserServer
I allways get CursorType=adOpenForwardOnly and LockType=adReadOnly

I'm not really sure why this is so for you. It has not been my experience.
Perhaps it has to do with a limitation of RDS. Or a version conflict between
RDS and the OLE DB provider you are using (I'm grasping at straws here)


If I change CursorLocation=asUseClient
I allways get CursorType=adOpenStatic and
LockType=adLockBatchOptimistic

What the ?

The latter result is expected. The only cursor type allowed with client-side
cursors is static. No matter what you request, you get static. The reason
for this is simple: with client-side cursors, the ADO cursor library handles
all cursor functionality. That means, it has to have all the data. So when a
client-side cursor is requested, ADO constructs a client-side cursor from
its library, and uses a server-side firehose cursor to populate it, closing
the server-side cursor when all the data has been sent. So, the client-side
cursor contains all the data that satisfies the sql statement and it cannot
respond to changes/deletions in the source data. This is the definition of a
static cursor. Also, since it has no direct connection to the underlying
data, it cannot apply a pessimistic lock.


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 ;-)

Why?


I missed the header that says Remote Data Service and I tried to be
funny, which obviously didn't work...

No, it worked (I smiled), but I was being subtle in return, which didn't
work. I guess I'm wondering why you are using this obsolete technology in a
C++ application. Typically that technology was used in client-server
scenarios such as ASP, where the client portion of the app had no direct
connection to the server portion. Is that what you are building here?



That's a job for a stored procedure with some output parameters.
Seriously, let SQL Server take care of your transactions for you:
create a stored procedure that accepts some input values, does all
the processing in the database, and returns the output values to
your application. Instead of output values, you could have it return
a resultset if multiple rows of output data are needed.

Can you recommend some URLs for teaching how to create stored
procedures? // Anders

Hmmm ... if you have SQL Server installed, you likely have access to SQL
Books OnLine (BOL). If not, you can download the version of BOL that fits
your version of SQL from Microsoft. See this article:
http://www.aspfaq.com/show.asp?id=2229

as well as these:
http://databases.aspfaq.com/database/using-stored-procedures.html - good
basic intro, albeit ASP-centric. And the author really had a bias against
output parameters, something which most of the expert community swears by.
His recommendation to use dynamic sql rather than parameters to execute
procedures is something that actually rebounded on this site a couple months
ago when it was the victim of one of those automated sql injection attacks
that hit so many of the sites on the internet. So read what he says about
creating procedures carefully, but gloss over his descriptions of how to
execute the procedures.

http://sqlserver2000.databases.aspfaq.com/where-else-can-i-learn-about-sql-server.html




--
Microsoft MVP - ASP/ASP.NET - 2004-2007
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"


.



Relevant Pages

  • 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: Geschwindigkeit optimieren ADO
    ... öffnen mit jeweils anderem SQL String ... -SQL Server Stored Procedure mit Command Objekt aufrufen-> Recordset ... adOpenForwardOnly, adLockReadOnly, auch mal Firehose Cursor genannt. ...
    (microsoft.public.de.sqlserver)
  • Re: Lookup executes 3 time upon Recordset.Save
    ... client side cursor and the SQL is now only executed once. ... executing my code three times (the code below is simplified fro ... > and {SQL Server} drivers): ...
    (microsoft.public.data.ado)
  • 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: New to ADO with Delphi
    ... server side, but the items where I need to show data or possibly perform ... updates I could run client-side in a query control. ... Client-side cursor ... Queries in Client Mode: 288,044 KB ...
    (borland.public.delphi.database.ado)