Re: Best way to find ID of new record
- From: "Daniel Crichton" <msnews@xxxxxxxxxxxxxxxxxx>
- Date: Thu, 23 Mar 2006 08:56:39 -0000
John wrote on Wed, 22 Mar 2006 09:49:29 -0800:
Thanks Dan. I will look into using a "Transaction on the Connection" to
avoid the problem you mention.
I studied my original question on MSDN and found the answer I needed (not
necessarily the question I asked). I said I used an mdb file but did not
mention that I also, in other applications, utilize SQL Server. I'm pretty
sure now that the code I listed will work with an access db but will not
work with SQL Server. That was what was confusing me. I have developed my
applications utilizing ADO and Queries in such a way that I might adapt to
either a mdb file or SQL Server by changing the provider part of the
connection string. Interestingly this is the first specific difference
(and incompatability) I have found between using an MDB file or SQL
Server. But studying MSDN Article 221931 raised some other questions. The
sample code lists the following:
objRS.Open "SELECT * FROM Customers", objConn, adOpenStatic,
adLockOptimistic AND THEN
objRS.AddNew
And ADO help says adOpenStatic is read only!
Strange.
As to dealing with SQL Server, I use adOpenKeyset with adUseServer and my
own version of the code you posted (pretty much the same) and it works fine.
I've moved almost all my applications to SQL Server with little or no code
modification.
Dan
.
- References:
- Best way to find ID of new record
- From: John Brown
- Re: Best way to find ID of new record
- From: Daniel Crichton
- Re: Best way to find ID of new record
- From: John Brown
- Best way to find ID of new record
- Prev by Date: Re: "No such interface supported" error on Catalog.Create and Connection.Open
- Next by Date: Component Checker
- Previous by thread: Re: Best way to find ID of new record
- Next by thread: Re: Best way to find ID of new record
- Index(es):
Relevant Pages
|
Loading