muti update table

Forum related to version 6.5.1 (alpha) and 6.6.x (beta) of ZeosLib's DBOs

Moderators: gto, cipto_kh, EgonHugeist

Post Reply
hitman
Fresh Boarder
Fresh Boarder
Posts: 9
Joined: 19.07.2006, 03:14

muti update table

Post by hitman »

how to muti update table
ex

select a.id,b.name from a,b where a.id=b.id
now i update a only
how to do !!
User avatar
dhongu
Junior Boarder
Junior Boarder
Posts: 37
Joined: 28.09.2005, 08:37
Location: Bucuresti
Contact:

Post by dhongu »

Use TZUpdateSQL and define InsertSQl, ModifiySQL, DeleteSQL property.


For update table a: update a set a.id = :id where a.id = :old_id
Dorin Hongu
hitman
Fresh Boarder
Fresh Boarder
Posts: 9
Joined: 19.07.2006, 03:14

Post by hitman »

tks
i did update a set id = :id where id = :old_id

so raise a error !! ha ha
btrewern
Expert Boarder
Expert Boarder
Posts: 193
Joined: 06.10.2005, 18:51

Post by btrewern »

Look at the help entries for the BDE TUpdateSQL component. The TZUpdateSQL works in a similar manner.

If you tell us what error you are getting, maybe someone could help you.

Regards,

Ben
User avatar
dhongu
Junior Boarder
Junior Boarder
Posts: 37
Joined: 28.09.2005, 08:37
Location: Bucuresti
Contact:

Post by dhongu »

Code: Select all

object Form2: TForm2
  
 
  object DBGrid1: TDBGrid

    DataSource = DataSource1

  end
  object DBNavigator1: TDBNavigator

    DataSource = DataSource1

  end
  object ZUpdateSQL1: TZUpdateSQL
    InsertSQL.Strings = (
      'insert into a  (id) value (:id);'
      ''
      'insert into b (id,name) values ( :id, :name );')
    ModifySQL.Strings = (
      'update a set a.id = :id where a.id = :old_id;'
      ''
      'update b set b.id = :id, b.name = :name where b.id= :old_id;')
    UseSequenceFieldForRefreshSQL = False
    Left = 136
    Top = 8
    ParamData = <
      item
        DataType = ftUnknown
        Name = 'id'
        ParamType = ptUnknown
      end
      item
        DataType = ftUnknown
        Name = 'old_id'
        ParamType = ptUnknown
      end
      item
        DataType = ftUnknown
        Name = 'name'
        ParamType = ptUnknown
      end>
  end
  object ZQuery1: TZQuery
    
    UpdateObject = ZUpdateSQL1
    SQL.Strings = (
      'select a.id,b.name from a,b where a.id=b.id')
    Params = <>
    Left = 88
    Top = 8
  end
  object DataSource1: TDataSource
    DataSet = ZQuery1
    Left = 176
    Top = 8
  end
end

Dorin Hongu
Post Reply