ASPN ActiveState Programmer Network
ActiveState
/ Home / Perl / PHP / Python / Tcl / XSLT /
/ Safari / My ASPN /
Cookbooks | Documentation | Mailing Lists | Modules | News Feeds | Products | User Groups


Recent Messages
List Archives
About the List
List Leaders
Subscription Options

View Subscriptions
Help

View by Topic
ActiveState
.NET Framework
Open Source
Perl
PHP
Python
Tcl
Web Services
XML & XSLT

View by Category
Database
General
SOAP
System Administration
Tools
User Interfaces
Web Programming
XML Programming


MyASPN >> Mail Archive >> ruby-talk
ruby-talk
Writing a SQL Query in Active Record?
by Anukul Singhal other posts by this author
May 8 2008 8:16AM messages near this date
Re: Compilation error in cont.c | Re: Writing a SQL Query in Active Record?
Hi,

I am using the following code snippet for connecting to SQL Server
through Active Record:

require 'rubygems'
require 'active_record'

ActiveRecord::Base.establish_connection(
:adapter =>  "sqlserver",
:host =>  "xxx.xxx.xxx.xxx,8080"
:username =>  "username"
:password =>  "password"
:database =>  "xyz_1008"
)

Now, I want to execute a query in this sql server after getting
successfully connected but am not aware how to do so. Can anyone give an
example as to how we write the query say ("Select * from Name") after
establishing the above connection successfully?

Thanks,
Anukul
-- 
Posted via http://www.ruby-forum.com/.
Thread:
Anukul Singhal
Phillip Gawlowski
Simon Krahnke
Phillip Gawlowski
Anukul Singhal
Phillip Gawlowski

Privacy Policy | Email Opt-out | Feedback | Syndication
© 2004 ActiveState, a division of Sophos All rights reserved