[Vserve+V4RB] several cursor.updates in a go

Eric Ferrer wonderfef at noos.fr
Thu Dec 9 10:31:51 CST 2004


Hello all,

I have a loop that updates several records.
This loop crashes the app, with no RB IDE debug error, just a Finder error.

I tried this is a push button :

  cursor = theDatabase.SqlSelect("SELECT * FROM myTable WHERE MyField =
'Test1'", 2, 1, 1)
  if cursor.RecordCount = 1 then
    v = cursor.Field("MyField").GetString + "***test"
    cursor.Field(" MyField").SetString v
    if cursor.Update = false then
      MsgBox "update failed"
    end if
  end if
  
  cursor = theDatabase.SqlSelect("SELECT * FROM MyTable WHERE Type =
'Test2'", 2, 1, 1)
  if cursor.RecordCount = 1 then
    v = cursor.Field("MyField").GetString + "***test"
    cursor.Field("MyField").SetString v
    if cursor.Update = false then
      MsgBox "update failed"
    end if
  end if
  
  cursor = theDatabase.SqlSelect("SELECT * FROM MyTable WHERE Type =
'Test3'", 2, 1, 1)
  if cursor.RecordCount = 1 then
    v = cursor.Field("MyField").GetString + "***test"
    cursor.Field("MyField").SetString v
    if cursor.Update = false then
      MsgBox "update failed"
    end if
  end if
  
  theDatabase.Flush

The app seems to always crash before the third update.

MyField is type text(256), and for some reasons not explained here, I need
to retrieve all fields from the table, even if I update only some fields.

What's wrong ?
Thank you very much for your help.

Eric




More information about the Valentina mailing list