Ruby Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me

The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.

Go Back   Dev Shed ForumsProgramming LanguagesRuby Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old October 29th, 2007, 07:38 AM
karym6 karym6 is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Nov 2003
Location: Edinburgh, UK
Posts: 84 karym6 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 12 h 17 m 22 sec
Reputation Power: 10
Send a message via MSN to karym6
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

Reply With Quote
  #2  
Old October 29th, 2007, 08:15 AM
L7Sqr L7Sqr is offline
Contributing User
Dev Shed Novice (500 - 999 posts)
 
Join Date: Jan 2004
Location: Constant Limbo
Posts: 989 L7Sqr User rank is Major (30000 - 40000 Reputation Level)L7Sqr User rank is Major (30000 - 40000 Reputation Level)L7Sqr User rank is Major (30000 - 40000 Reputation Level)L7Sqr User rank is Major (30000 - 40000 Reputation Level)L7Sqr User rank is Major (30000 - 40000 Reputation Level)L7Sqr User rank is Major (30000 - 40000 Reputation Level)L7Sqr User rank is Major (30000 - 40000 Reputation Level)L7Sqr User rank is Major (30000 - 40000 Reputation Level)L7Sqr User rank is Major (30000 - 40000 Reputation Level)L7Sqr User rank is Major (30000 - 40000 Reputation Level) 
Time spent in forums: 2 Weeks 2 Days 22 h 45 m 6 sec
Reputation Power: 362
Send a message via AIM to L7Sqr
In order to save us the trouble of duplicating your effort, what have you tried and what error messages have you received indicating that 'it' did not work?

Until then, here are the top three hits I get from google (each with an example)
one
two
three
__________________
True happiness is not getting what you want, it's wanting what you've already got.

My Blog

Reply With Quote
  #3  
Old October 29th, 2007, 08:17 AM
karym6 karym6 is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Nov 2003
Location: Edinburgh, UK
Posts: 84 karym6 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 12 h 17 m 22 sec
Reputation Power: 10
Send a message via MSN to karym6
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...

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming LanguagesRuby Programming > Connecting to MS SQL with RUby

Developer Shed Advertisers and Affiliates



Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

© 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap