Welcome to Working With Rails


Discussion Forums

Discuss all things Ruby on Rails with perhaps the web's most vibrant group of Ruby on Rails enthusiasts.
3 Posts

gud day to all. i have a problem with system function. can i passing more than two arguments in that function. for example system('mdb-sql','db1.mdb',args).i can only sent two arguments only in this function.the third argument i need coz i wanna do some select query statement from database. ur help will so appreciate

Check the api for Kernel::System. Your args need to be the second parameter. Use double-quoted strings and the #{} syntax to easily build your paramter strings.

I think you want

system('mdb-sql', "db1.mdb #{args}")

You can also just omit the second paramter altogether and just build up one long command string.

system("mdb-sql db1.mdb #{args}")

Hope that helps!

thanks brian.i tried ur solution but still cant work.suddenly i found this web http://www.oracle.com/technology/pub/articles/gagne_access.html and when i altered the command using my own its working.this the command im use

system 'echo "select * from user" |mdb-sql db1.mdb'

3 Posts
Login to add your message