[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

Database Query

Erik Johansen

9/22/2008 11:52:00 AM

Hello.

Im trying to fetch a value from a field in our database, using this
code.

selected = @site.db.select("select car from car_sale where id=402 AND
email='a1@a.com'")

But this throws the errormessage.
RemoteDatabase::Error: invalid environment

Does anybody knows how to get a value properly from the db?

Kind regards
-Erik
--
Posted via http://www.ruby-....

2 Answers

Brian Candler

9/22/2008 12:03:00 PM

0

Erik Johansen wrote:

> Im trying to fetch a value from a field in our database, using this
> code.
>
> selected = @site.db.select("select car from car_sale where id=402 AND
> email='a1@a.com'")
>
> But this throws the errormessage.
> RemoteDatabase::Error: invalid environment
>
> Does anybody knows how to get a value properly from the db?

You'll need to provide more info first.

(1) What database access library and version are you using? How did you
install it? Did you build any parts of it yourself? If so, what commands
did you use?
(2) What database and version are you talking to? Can you demonstrate
the same select query using a CLI client for that database?
(3) What code did you use to create @site.db?
(4) What version of Ruby are you running?
(5) What operating system are you running Ruby under?

("ruby -v" gives a short answer to (4) and (5))
--
Posted via http://www.ruby-....

Todd Benson

9/22/2008 11:19:00 PM

0

On Mon, Sep 22, 2008 at 6:51 AM, Erik Johansen
<jon.erik.johansen@finn.no> wrote:
> Hello.
>
> Im trying to fetch a value from a field in our database, using this
> code.
>
> selected = @site.db.select("select car from car_sale where id=402 AND
> email='a1@a.com'")
>
> But this throws the errormessage.
> RemoteDatabase::Error: invalid environment
>
> Does anybody knows how to get a value properly from the db?

You specify here your table and fields, but no mention of the
database. How are you connecting to the database?

Todd