Member Login

Username
Password
Forget Password
New Sign Up
Search Forum

Buy Support
Incidents

If you can't find your answer in the FREE PUBLIC QDeveloper Forum, require URGENT Priority Support, or you need to send us private or confidential information:

Click Here
If you can't login and post questions or you are having trouble viewing forum posts:
Click Here
Callback
Support

If you live in USA, UK, Canada, Australia or New Zealand, you can leave us details on your question and request us to call you back and discuss them with you personally  (charges apply).

Click Here
 
Buy Support
Incidents
If you can't find your answer in the FREE PUBLIC QDeveloper Forum, require URGENT Priority Support, or you need to send us private or confidential information:
Click Here

Forum : 'Query cannot be updated' and other errors after upgrading to Ver 4Search Forum

Forum Home > FlexODBC - ODBC Driver for DataFlex Embedded DBMS > FlexODBC Forum

 New Topic 
 
 Post Reply 
[1]  
 'Query cannot be updated' and other errors after upgrading to Ver 4 
 Author   Message 
  Cheryl 
  
 Group: Members 
 Posts: 2 
 Joined: 2008-02-21 
 Profile
 Posted : 2008-02-21 07:48:25
After upgrading to Version 4, our existing VB 6 applications have broken. Is version 4 not backward compatible? Is the driver using query-based updates as mentioned in the following article? http://support.microsoft.com/kb/326166 any workarounds for this? We are using invoice numbers as the unique id, which is causing the problem...... Another application is ignoring the ADO recordset's EOF property - in code that has been in regular use for almost 8 years with version 3! We need Version 4 for VB .Net 2005, yet we still need to be able to run our legacy apps on the same machine. Sure hope this is something wrong we're doing on our end - thanks for any suggestions you can provide... 

  Top 
  Tom 
  6c3c1_sdk-qodbc.gif
 Group: Administrator 
 Posts: 5510 
 Joined: 2006-02-17 
 Profile
 Posted : 2008-02-21 22:09:19

First of all, in a DataFlex table, the RECORD_NUMBER is always the unique id. While you can assign other DataFlex indexes where the Invoice Number can also be the unquie id, this is something that MUST already be in the structure of the datafile itself, and not something you can choose.

ODBC cursor errors are common because FlexODBC only supports static or forward only type cursors. The work around is to always use ForwardOnly Cursors. For example with ADO keyset cursors we recommend:

With rs
    .CursorType = CursorTypeEnum.adOpenForwardOnly
    .LockType = LockTypeEnum.adLockOptimistic
    .CursorLocation = CursorLocationEnum.adUseServer
End With

And just in case you try switching everything to adUseServer, please be aware FlexODBC stored procedure calls like sp_tables only like adUseClient cursor types.

But, some customers have also had to use this combination of variables with VB 6:

Const adOpenStatic = 3
Const adLockOptimistic = 3
Const adUseClient = 3

oRecordset.CursorType = 2
oRecordset.LockType = 3
oRecordset.CursorLocation = adUseClient

To prevent a "Query-based update failed because the row to update could not be found." type error.

As far as the EOF issue is concerned, the problem seems to happen in VB also becasue of the recordset cursor location. As you can see in the below code when the cursorlocation of the tquery is changed to clUseServer rather than the default, it works.....

try
      itmQuery := TADOQuery.Create(self);
      itmQuery.Connection := oConn;
      itmQuery.CursorType := ctDynamic;
      itmQuery.CursorLocation :=  clUseServer;
      itmQuery.LockType := ltOptimistic;
      itmQuery.SQL.Clear;
      itmQuery.SQL.Add('Select * from Customer');
      itmQuery.Open;
      if itmQuery.eof then begin
        showmessage('EOF');;
      end
      else begin
        showmessage('Not EOF');
      end;
    finally
      itmQuery.Close;
      itmQuery.free;
    end;

 

 

  Top 
 New Topic 
 
 Post Reply 
[1]  

Jump to