Using a VB6 dynaset object in dot NET

D

Dave Cullen

I have a VB6 program that I'm trying to convert to run under VB.NET. The
application uses an Oracle database and Oracle OO4E objects to
connect and retrieve data:

'OraSession, Oradatabase and dynLog are Objects
'strSql is a SELECT statement

OraSession = CreateObject("OracleInProcServer.XOraSession")
Oradatabase = OraSession.dbopendatabase(DBName, ConnStr, 0&)

dynLog = Oradatabase.dbcreatedynaset(strSql, 0&)
dynLog.Refresh()
dynLog.DbMoveFirst()

All of which compiles and runs in .NET ok. In VB6 the individual data
elements retrieved by the sql select are accessed via the dynaset array
elements...

strLineNo = dynLog(4) 'a text value from the table

.... but .NET issues an exception. The object does not relate to the
context of string data.

How do I get to the data? I do NOT want to rewrite the entire
application using the .NET OLEDb controls.

Thanks

Dave
 
P

Paul Clement

¤ I have a VB6 program that I'm trying to convert to run under VB.NET. The
¤ application uses an Oracle database and Oracle OO4E objects to
¤ connect and retrieve data:
¤
¤ 'OraSession, Oradatabase and dynLog are Objects
¤ 'strSql is a SELECT statement
¤
¤ OraSession = CreateObject("OracleInProcServer.XOraSession")
¤ Oradatabase = OraSession.dbopendatabase(DBName, ConnStr, 0&)
¤
¤ dynLog = Oradatabase.dbcreatedynaset(strSql, 0&)
¤ dynLog.Refresh()
¤ dynLog.DbMoveFirst()
¤
¤ All of which compiles and runs in .NET ok. In VB6 the individual data
¤ elements retrieved by the sql select are accessed via the dynaset array
¤ elements...
¤
¤ strLineNo = dynLog(4) 'a text value from the table
¤
¤ ... but .NET issues an exception. The object does not relate to the
¤ context of string data.
¤
¤ How do I get to the data? I do NOT want to rewrite the entire
¤ application using the .NET OLEDb controls.

I'm not familiar with the OO4O object model but do the Dynaset array elements have a default
property, such as Value? If so, you may need to explicitly specify this property (e.g.
dynLog(4).Value).


Paul
~~~~
Microsoft MVP (Visual Basic)
 

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

Top