If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > Delphi, C etc > ADO locks and tables with computed columns

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 02-06-03, 11:43
zarathustra zarathustra is offline
Registered User
 
Join Date: Feb 2003
Posts: 6
ADO locks and tables with computed columns

Help me I'm melting.

SQLServer2000
ADO (access 2000)

My ADO recordset to a table with an index which includes a computed column is locked in my form. No updates possible. ANY suggestions at this point would be welcome - it's going on hour 6 with this an related probs.

TIA
Reply With Quote
  #2 (permalink)  
Old 02-06-03, 13:44
Ad Dieleman Ad Dieleman is offline
Registered User
 
Join Date: Jan 2003
Location: Dordrecht, The Netherlands
Posts: 95
Re: ADO locks and tables with computed columns

Quote:
Originally posted by zarathustra
Help me I'm melting.

SQLServer2000
ADO (access 2000)

My ADO recordset to a table with an index which includes a computed column is locked in my form. No updates possible. ANY suggestions at this point would be welcome - it's going on hour 6 with this an related probs.

TIA
Just to be sure: did you create a primary key on the table?

Ad Dieleman.
Reply With Quote
  #3 (permalink)  
Old 02-06-03, 15:31
zarathustra zarathustra is offline
Registered User
 
Join Date: Feb 2003
Posts: 6
Re: ADO locks and tables with computed columns

Yes. The Primary Key is composite 3 columns with the third column being the computed value.

SQL2000 is fine with all of this, but I'm not sure what kind of lock ADO is taking out behind the scenes but the DataSheet on my form is locked where Datasheet.Recordset = (select from the table) - roughly.

Any help is appreciated.

TIA
Reply With Quote
  #4 (permalink)  
Old 02-07-03, 03:21
Ad Dieleman Ad Dieleman is offline
Registered User
 
Join Date: Jan 2003
Location: Dordrecht, The Netherlands
Posts: 95
Re: ADO locks and tables with computed columns

A few things you can check:

1) Open the Query Analyzer of SQL Server and check if you can update the table. If not, something's wrong with your permissions.

2) Open the recordset with cursortype adOpenDynamic. The default is adOpenForwardOnly which doesn't allow any changes on the recordset.
You'd need a statement like
'rstRes.Open CursorType:=adOpenDynamic'

3) I don't know if the recordset will be updateable when using a calculated column in the primary key. You can find this out by adding an identity field which you then use as a primary key and maintaining a unique index for your original primary key.

Ad Dieleman.
Reply With Quote
  #5 (permalink)  
Old 02-07-03, 05:02
zarathustra zarathustra is offline
Registered User
 
Join Date: Feb 2003
Posts: 6
Re: ADO locks and tables with computed columns

Quote:
Originally posted by Ad Dieleman
A few things you can check:

1) Open the Query Analyzer of SQL Server and check if you can update the table. If not, something's wrong with your permissions.

2) Open the recordset with cursortype adOpenDynamic. The default is adOpenForwardOnly which doesn't allow any changes on the recordset.
You'd need a statement like
'rstRes.Open CursorType:=adOpenDynamic'

3) I don't know if the recordset will be updateable when using a calculated column in the primary key. You can find this out by adding an identity field which you then use as a primary key and maintaining a unique index for your original primary key.

Ad Dieleman.
1) would not have been a permission thing.
2) yes
3) it's definitely the computed field in the key that's doing the locking - ADO is doing something in the background and is documented terribly (having said that I'm no VB programmer)

But using an identity PK + the UNIQUE constraint DOES work. Thanks tons for making me rethink. No more bad data for me.
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On