[lnkForumImage]
TotalShareware - Download Free Software

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


 

Forums >

comp.lang.ruby

ruby dbi and sql server 2000

aidy

8/6/2008 1:00:00 PM

I hava a class that connects to SQL Server 2000

class SQLServerConnection
attr_reader :row

def initialize(server_name, db)
@db = db
@dbh=DBI.connect("DBI:ADO:Provider=SQLOLEDB;Data
Source=#{server_name};Intitial Catalog=#{@db};Integrated
Security=SSPI")
end


def execute_sql(sql)
@dbh.execute("USE #{@db}")
sth = @dbh.prepare(sql)
sth.execute
@row=sth.fetch
end
end


sql_server = SQLServerConnection.new('v-w-dcs-test1',
'DcsOrderTracking')
sql_server.execute_sql("DELETE FROM [OrderLineStatus]")


I am receiving this error

DBI::DatabaseError: EOF

OLE error code:800A0E78 in ADODB.Recordset

Operation is not allowed when the object is closed.

HRESULT error code:0x80020009

Exception occurred.


But I am not sure why.

Any ideas?

Thanks

Aidy
2 Answers

Dejan Dimic

8/6/2008 1:35:00 PM

0

On Aug 6, 3:00 pm, aidy <aidy.le...@googlemail.com> wrote:
> I hava a class that connects to SQL Server 2000
>
> class SQLServerConnection
>     attr_reader :row
>
>     def initialize(server_name, db)
>       @db = db
>       @dbh=DBI.connect("DBI:ADO:Provider=SQLOLEDB;Data
> Source=#{server_name};Intitial Catalog=#{@db};Integrated
> Security=SSPI")
>    end
>
>     def execute_sql(sql)
>       @dbh.execute("USE #{@db}")
>       sth = @dbh.prepare(sql)
>       sth.execute
>       @row=sth.fetch
>     end
>   end
>
>   sql_server = SQLServerConnection.new('v-w-dcs-test1',
> 'DcsOrderTracking')
>   sql_server.execute_sql("DELETE FROM [OrderLineStatus]")
>
>    I am receiving this error
>
>    DBI::DatabaseError: EOF
>
>    OLE error code:800A0E78 in ADODB.Recordset
>
>    Operation is not allowed when the object is closed.
>
>    HRESULT error code:0x80020009
>
>    Exception occurred.
>
>    But I am not sure why.
>
>    Any ideas?
>
>    Thanks
>
>    Aidy

Take look at http://www.kitebird.com/articles/rub...

Damjan Rems

8/7/2008 5:32:00 AM

0

aidy wrote:

> I am receiving this error
>
> DBI::DatabaseError: EOF
>
> OLE error code:800A0E78 in ADODB.Recordset
>
> Operation is not allowed when the object is closed.
>
> HRESULT error code:0x80020009
>
> Exception occurred.

Why not just something like this:
sql_server.dbh.do("DELETE FROM [OrderLineStatus]")

by
TheR
--
Posted via http://www.ruby-....