aidy1
(aidy)
1
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
···
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
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-forum.com/\.