Re: Duplicate Record with .ADDNEW

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




"Ralph" <nt_consulting64@xxxxxxxxx> wrote in message
news:bemdnVe0bIVR6sXYnZ2dnUVZ_rydnZ2d@xxxxxxxxxxxxxxx

<goadswapnil@xxxxxxxxx> wrote in message
news:1163403862.936003.144180@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Hey Guys you are not concentrating on the real source of the problem.
The first and foremost is that there's a serious flaw in the schema of
this table.

<snipped>

Mark McGinty wrote:
"Ralph" <nt_consulting64@xxxxxxxxx> wrote in message
news:w46dnb7uCuhu5MvYnZ2dnUVZ_vSdnZ2d@xxxxxxxxxxxxxxx


However, I wouldn't use the Connection.Execute method. There is no
reason
to
return a recordset. Use the Command object instead.

Connection.Execute accepts adExecuteNoRecords as an option, just like
Command.Execute. If he's just going to construct ad-hoc SQL and exec
it,
what's the difference? If you suggested parameterizing, and/or reusing
the
command object, I could see a reason fot the extra code and object
overhead,
but from the looks of the OP's code, I'm not sure what he has to gain
there.

<snipped>

The reason to avoid a recordset, is simply because it is not needed. You
can
certainly use a recordset object to execute a query and then tell it to
ignore the return, but why go there?

Whoa, hold the phone <the sound of all 18 wheels of a big rig locking-up on
dry pavement pervades the air for what seems an eternity> (damn that was a
long pseudo-tag!) :-)

We were talking about Connection.Execute, with adExecuteNoRecords passed in
options.

I could see your point about creating a recordset to exec a
non-row-returning SQL statement, that would be pretty whacked -- but that's
not at all where this spin-off thread started.

Let's recap...

You suggested Command.Execute instead of Connection.Execute;
I asked why?
You cited unnecessary recordset creation;
I offered adExecuteNoRecords;
You said, "I'll take 'Insane usage of Recordsets' for $100, Alex";
I heard the low screeching howl of huge split-rim tires, still moving though
they've ceased to roll;
(Alex Trebek had to remind you to phrase your answer as a question)
(I'm not sure who got the Daily Double)

Did I miss something? :-)


-Mark





I heartily agree with both of you. Especially at this point - to
paraphrase
Sherlock Holmes - Once you remove the impossible, whatever remains, no
matter how improbable, is the possible.

AddNew/Update is known the be buggy. It's gone.
Using a Recordset when is one is not needed (especially if using As New)
may
be an issue - it's gone.

Now I believe you guys are correct. Adding a non-duplicate key would be a
good solution, and there is obviously something going on.

-ralph






.



Relevant Pages