Can't execute stored procedure in ruby

I have written ruby code to connect SQL server , using gem ‘odbc’ i
could connect sql server and execute query to select and update tables
but when i tried to call stored procedure it skips the execution and
shows no error
here is my code

require ‘rubygems’
require ‘odbc’
odbcdatasource = ‘odbcdata’
usrname = ‘uname’
pswd = ‘paswd’

sqlQuery = “EXEC create_candidates”
ODBC.connect(odbcdatasource,usrname,pswd)do |bd|
results =

Is there any other method to call stored procedure in ruby code ??

thank you
nibin c

Hi nibin,

my advice is to use something like activerecord
(activerecord | | your community gem host) because in the
long run, it’s going to make your life a lot easier.

Otherwise, there seems to be quite a bit of information about ruby-odbc
collected in this forum, if you use the search box you can search
through the answers to similar problems.

In the example you posted, you haven’t closed the block with “end”. It’s
also helpful to take the extra couple of minutes to format the code so
that it’s easier for everyone to read.