
HELP! SQL Server 6.5/ADO2/VB6 Question
I am developing an ADO 2 front end written in a mixture of VB and VC++
(mainly VB so far), and need to maintain compatability allowing the user to
use either a central SQL Server database or a local Access database with the
same schema.
So, I developed the database in Access and then used the upsizing wizard to
produce a SQL Server version. No problems. The tables contain Autonumber ID
fields which are converted to Identity fields with a dw_ZeroDefault.
Now the ADO app works fine for the Access database, and reads the SQL Server
database fine too, BUT adding new records to the SQL Server database (using
Recordset.AddNew) results in "Errors Occurred. 80040e21"
I guess this is related to problems with "Attempt to explicitly update
identity field" problems as I have also seen this error message. Although I
am not explicitly setting the identity field, ID. I.e.
...
rs.AddNew
rs.Fields("Name").Value = "HELP!"
rs.Update ' Fail - tried to explicitly alter identity field
....
I assume this is either a problem with the way the upsizing wizard has
structured the tables/identities or the way in which the SQL Server OLEDB
provider constructs the AddNew query.
Any ideas anyone as I am fresh out of them?
Thanks in advance,
Matt.
Matt Hammond
Application Electronics Limited
Brackley, UK