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
odbcdatasource = ‘odbcdata’
usrname = ‘uname’
pswd = ‘paswd’
sqlQuery = “EXEC create_candidates”
results = bd.run(sqlQuery)
Is there any other method to call stored procedure in ruby code ??
my advice is to use something like activerecord
(https://rubygems.org/gems/activerecord/versions/4.2.6) 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.