On Sep 21, 7:16 am, gregh <[email protected]> wrote: > I was just testing the ado connection on a real world file. Using the > code "securities.filter(:ACCOUNT => '333').each{|x| p x}" works fine > with the odbc. It didn't work out of the box with the ado version. > > print securities.filter(:ACCOUNT => '333').sql > > the odbc version outputs: > SELECT * FROM "CAMDATA" WHERE ("ACCOUNT" = '333') > > the ado version outputs: > SELECT * FROM [CAMDATA] WHERE ([ACCOUNT] = N'333') > > Running the code on the ado version: > securities.filter(:ACCOUNT => '333').each{|x| p x} > > c:/ruby/lib/ruby/gems/1.8/gems/sequel-3.4.0/lib/sequel/adapters/ado.rb: > 46:in `method_missing': WIN32OLERuntimeError: Execute > (Sequel::DatabaseError) > OLE error code:80040E14 in Microsoft JET Database Engine > Syntax error (missing operator) in query expression '([ACCOUNT] > = N'333')'. > HRESULT error code:0x80020009 > Exception occurred. > from c:/ruby/lib/ruby/gems/1.8/gems/sequel-3.4.0/lib/sequel/adapters/ > ado.rb:46:in `execute' > from c:/ruby/lib/ruby/gems/1.8/gems/sequel-3.4.0/lib/sequel/ > connection_pool.rb:112:in `hold' > from c:/ruby/lib/ruby/gems/1.8/gems/sequel-3.4.0/lib/sequel/ > database.rb:481:in `synchronize' > from c:/ruby/lib/ruby/gems/1.8/gems/sequel-3.4.0/lib/sequel/adapters/ > ado.rb:44:in `execute' > from c:/ruby/lib/ruby/gems/1.8/gems/sequel-3.4.0/lib/sequel/ > dataset.rb:333:in `execute' > from c:/ruby/lib/ruby/gems/1.8/gems/sequel-3.4.0/lib/sequel/adapters/ > ado.rb:82:in `fetch_rows' > from c:/ruby/lib/ruby/gems/1.8/gems/sequel-3.4.0/lib/sequel/ > dataset.rb:189:in `each' > from c:/ruby/lib/ruby/gems/1.8/gems/sequel-3.4.0/lib/sequel/adapters/ > shared/mssql.rb:171:in `each' > from test_sequel_connstring.rb:7
The ADO adapter defaults to assuming SQL Server syntax, so you need to override it: DB=Sequel.ado(:conn_string=>'Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\mydata\my_file.xls;Extended Properties=Excel 8.0;', :driver=>'') Jeremy --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "sequel-talk" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/sequel-talk?hl=en -~----------~----~----~----~------~----~------~--~---
