require 'phi'; include Phi
require 'rdb'; include RDB
require 'com'

form = Component._load open('Unit1.afm', 'rb').read

require 'control_tree.rb'

p form.ado_connection1.properties['DBMS Name'].value

form.panel1.button1.on_click = proc do |sender|
  begin
    form.ado_connection1.execute <<'EOT'
SELECT * INTO Customers IN "C:\tmp" "Paradox 7.x;" FROM 得意先
EOT
  rescue
    p $!
  end
end

form.panel1.button2.on_click = proc do |sender|
  begin
    form.ado_connection1.execute <<'EOT'
SELECT * INTO Customers IN "C:\tmp\Northwind.xls" "Excel 8.0;" FROM 得意先
EOT
  rescue
    p $!
  end
end

form.panel1.button3.on_click = proc do |sender|
  begin
    form.ado_connection1.execute <<'EOT'
SELECT * INTO [Customers.htm] IN "C:\tmp" "HTML Export;" FROM 得意先
EOT
  rescue
    p $!
  end
end

form.show
Phi.mainloop
