T
Timo
I would be very grateful for help discovering the cause of this
mysterious problem. I'm in the dark, but maybe these clues
will turn on a lightbulb for somebody?
I have an Access 2000 ADP connected to SQL Server 2000 database.
The Access forms are working correctly; individual inserts,
updates, and deletes work. However, I have a subroutine that
inserts a group of records using an ADODBCommand, and this command
fails to insert any records, yet no error is raised! It just fails
silently.
The command's connection is based on a "trusted user" --
Integrated Security SSPI in the connection string.
APPROACH #1
The command is CommandType.Text, so after cmd.Execute is invoked,
I examine my INSERT statement in SQL Trace; when I paste the
statement into Query Analyzer and run it, the expected records DO
get inserted. So my SQL insert command is valid and well-formed,
and it is getting through to the database.
APPROACH #2
Thinking to take another approach, I use two Recordsets. I select
the records I want to insert, loop through the source recordset,
and invoke the AddNew method on the target recordset, assigning
the fields individually and invoking the target recordset's Update
method with each iteration. This approach does not insert any
records either. And it too fails silently, without error!
APPROACH #3
Thinking to take yet another approach, I rewrite the insert
command as a stored procedure, and change my command to
CommandType.StoredProcedure. Here, I DO get an error. "Could not
find stored procedure <spname>". I have granted execute on the
stored procedure to PUBLIC, and have tried prefixing the owner to
the SP name. Still get the error.
What might cause Approach #1 and #2 to fail without error?
And what should I do to get around the error in #3?
Many thanks in advance.
Timo
mysterious problem. I'm in the dark, but maybe these clues
will turn on a lightbulb for somebody?
I have an Access 2000 ADP connected to SQL Server 2000 database.
The Access forms are working correctly; individual inserts,
updates, and deletes work. However, I have a subroutine that
inserts a group of records using an ADODBCommand, and this command
fails to insert any records, yet no error is raised! It just fails
silently.
The command's connection is based on a "trusted user" --
Integrated Security SSPI in the connection string.
APPROACH #1
The command is CommandType.Text, so after cmd.Execute is invoked,
I examine my INSERT statement in SQL Trace; when I paste the
statement into Query Analyzer and run it, the expected records DO
get inserted. So my SQL insert command is valid and well-formed,
and it is getting through to the database.
APPROACH #2
Thinking to take another approach, I use two Recordsets. I select
the records I want to insert, loop through the source recordset,
and invoke the AddNew method on the target recordset, assigning
the fields individually and invoking the target recordset's Update
method with each iteration. This approach does not insert any
records either. And it too fails silently, without error!
APPROACH #3
Thinking to take yet another approach, I rewrite the insert
command as a stored procedure, and change my command to
CommandType.StoredProcedure. Here, I DO get an error. "Could not
find stored procedure <spname>". I have granted execute on the
stored procedure to PUBLIC, and have tried prefixing the owner to
the SP name. Still get the error.
What might cause Approach #1 and #2 to fail without error?
And what should I do to get around the error in #3?
Many thanks in advance.
Timo