Updating a row in a recordset

Updating a row in a recordset

am 07.09.2007 23:04:32 von Charlie

What properties to you set to make a SQL 2005 recordset updatable?

In Access, it's
Recordset.edit
Recordset!FieldName=SomeValue
Recordset.update

Any help is appreciated.

Re: Updating a row in a recordset

am 07.09.2007 23:18:42 von Erland Sommarskog

Charlie (jadkins4@yahoo.com) writes:
> What properties to you set to make a SQL 2005 recordset updatable?
>
> In Access, it's
> Recordset.edit
> Recordset!FieldName=SomeValue
> Recordset.update
>
> Any help is appreciated.

There are no properties you can set. Either the column is updatable or
it is not.

Un-updatable columns are for instance computed columns, or columns from
UNION queries.

You can always address the problem by bouncing the data over a temp table.




--
Erland Sommarskog, SQL Server MVP, esquel@sommarskog.se

Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/prodtechnol/sql/2005/downlo ads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodinfo/previousversions/books .mspx

Re: Updating a row in a recordset

am 08.09.2007 15:53:38 von Dan Guzman

To add on to Erland's response, APIs that use client cursors often require
that each row have a unique column(s) (e.g. primary key) in order to be
updatable. This is because an UPDATE statement is generated under the
covers and the generated WHERE clause needs to specify values that uniquely
identify the row to be updated. Make sure all tables have a primary key.


--
Hope this helps.

Dan Guzman
SQL Server MVP

"Charlie" wrote in message
news:46e1bcd7$0$32553$4c368faf@roadrunner.com...
> What properties to you set to make a SQL 2005 recordset updatable?
>
> In Access, it's
> Recordset.edit
> Recordset!FieldName=SomeValue
> Recordset.update
>
> Any help is appreciated.
>