ruby dbi and sql server 2000

A

aidy

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
 
D

Dejan Dimic

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/ruby-dbi.html
 
D

Damjan Rems

aidy said:
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,967
Messages
2,570,148
Members
46,694
Latest member
LetaCadwal

Latest Threads

Top