|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Stop making mediocre tutorials.The best tutorials are video! Camtasia Studio makes it easy to create engaging, buzz-building screen videos at any size, in any popular format. Download the free trial!
|
|
#1
|
|||
|
|||
|
Connecting to MS SQL with RUby
Hi There
can anyone give me a very basic example of using Ruby to connect to an MS SQL server, along with a basic example of of a select query? I have been trawling the Internet in vain, none of the examples I have tried so far have worked at all and I am starting to think this may be the wrong tool for the job...Cheers - K |
|
#3
|
|||
|
|||
|
actually answered some of my own question already with this:
Code:
require 'dbi'
oConn = DBI.connect('DBI:ADO:Provider=SQLNCLI;Data Source="YOUR_DB_NAME";User ID="YOUR_DB_USERNAME";password="YOUR_DB_PASSWORD"')
oConn.select_all('YOUR_SQL_STATEMENT'){|row| puts row}
This will print everything on the screen in quite a messy way, everything is put on a new line - which is my next task ![]() Any comments greatly appreciated - I have a feeling that Ruby and MS SQL is pretty much not used at the moment together, something I will assume changing when IronRuby debuts... |
![]() |
| Viewing: Dev Shed Forums > Programming Languages > Ruby Programming > Connecting to MS SQL with RUby |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|