ADO Recordset Update Support

December 05th, 2011 - 11:57 am ET by Steve | Report spam
Hi folks,

I've never used an ADO connection on anything more complicated than an
old Access database in the past. Now I am connecting to an SQL2005
database. Within the SQL studio environment I don't have any group
permission restrictions related to the table/fields I am connecting to
- I have Update|Insert|Delete|Select permission; I can change any of
these at will if necessary.

I am able to connect to the table, create a recordset, but I am not
able to update any of the field contents.

Const adUpdate=7
Const adUpdateBatch=8

cn.ConnectionString = sCnString

rsCurTable.Open strSQLSyntax, cn, adOpenKeyset, adLockOptimistic

rsCurTable.Supports(adUpdate)
'** No matter what combination of Cursor types & record lock types I
use I just can't get the Record Set "Supports" method to report a
value of "TRUE"; hence indicating that I am allowed to update the data
with the current connection.


'** Trying the alter the data anyway I am using on of two methods to
alter/update the field data ...

rsCurTable.MoveFirst

'First Method of Updating
rsCurTable.fields(ATTACHBEGFIELD).value=strBegFamProdId
rsCurTable.Update

'** The resulting error occurs for both update approaches ...
Error# 3265: Item cannot be found in the collection corresponding to
the requested name or ordinal. at line 238

'Second Method of Updating - yields same error
rsCurTable.Update ATTACHBEGFIELD,strBegFamProdID

Within the connection string the provider I am using is:
Provider=SQLOLEDB.1;
Integrated Security=SSPI;
password=????????????;
database=????????????;

I don't know if this provider does or doesn't support updates, or if
this is just an obvious mis-configuration which would be obvious to an
experienced DB programmer.

Thanks for any insight.

~Steve
email Follow the discussionReplies 4 repliesReplies Make a reply

Replies

#1 Steve
December 05th, 2011 - 02:09 pm ET | Report spam
Well, I answered my own question. Never overlook the simple. It
turns out I made the very rookie mistake of not including the fields I
wanted to update in my recordset Select query. I was so fixated on
the "FALSE" return value for the Recordset Supports method that I
overlooked the obvious.

FYI: The recordset.supports method still contintues to return a value
of "False" although I can properly update my targeted field values.
Either my constant values are wrong or my Objects are just out of date
and incompatible. I also ended up utilizing the updated SQL Native
Client service provider "Provider=SQLNCLI;" although I found no
mentions of incompatibility for updating SQL2005 databases with the
"Provider=SQLOLEDB.1;" in my googling.

~Steve


Const adUpdate=7
Const adUpdateBatch=8

cn.ConnectionString = sCnString

rsCurTable.Open strSQLSyntax, cn, adOpenKeyset, adLockOptimistic

rsCurTable.Supports(adUpdate)
'** No matter what combination of Cursor types & record lock types I
use I just can't get the Record Set "Supports" method to report a
value of "TRUE"; hence indicating that I am allowed to update the data
with the current connection.

'** Trying the alter the data anyway I am using on of two methods to
alter/update the field data ...

rsCurTable.MoveFirst

'First Method of Updating
 rsCurTable.fields(ATTACHBEGFIELD).value=strBegFamProdId
rsCurTable.Update

'** The resulting error occurs for both update approaches ...
Error# 3265: Item cannot be found in the collection corresponding to
the requested name or ordinal. at line 238

'Second Method of Updating - yields same error
rsCurTable.Update ATTACHBEGFIELD,strBegFamProdID

Within the connection string the provider I am using is:
Provider=SQLOLEDB.1;
Integrated Security=SSPI;
password=????????????;
database=????????????;

I don't know if this provider does or doesn't support updates, or if
this is just an obvious mis-configuration which would be obvious to an
experienced DB programmer.

Similar topics