Converting an Oracle Data Reader into a SQL Server Data Reader

G

Guest

Hi everybody,


Does anybody know if it is possible to convert an
Oracle Data Reader into a SQL Server Data Reader.
I unsucessfully tried using the Ctype function.
My problem is that I am developing a system that
should work with both SQL Server 2000 and Oracle 9i.
So I would like to use the same classes and methods to
access both databases.
Does anyone did it before?


Thanks a lot,


Amintas
 
F

Frans Bouma

Hi everybody,


Does anybody know if it is possible to convert an
Oracle Data Reader into a SQL Server Data Reader.
I unsucessfully tried using the Ctype function.
My problem is that I am developing a system that
should work with both SQL Server 2000 and Oracle 9i.
So I would like to use the same classes and methods to
access both databases.
Does anyone did it before?
Your code that should work with both databases should use IDataReader
types, like (using VB, since you mention CType)

' Create a datareader for the current database, can be oracle or sqlserver
Dim myDataReader As IDataReader = CreateDataReader()
' now work with the myDataReader as you do now, it should work.

Frans
 
M

Miha Markic

Hi,

In addition to Frans.
IOW Frans is talking about factory pattern - where you use interfaces
instead of specialized classed.
The other way would be to use OleDb namespace (with some speed cost).
 
A

Amintas Lopes Neto

Hi Frans and Miha,


Thank you very much for your support.
I have tried the interface approach proposed by Frans.
I worked beautifully!
That's exactly what I was looking for since I will have
better performance.
Thanks again!


Cheers,



Amintas
 

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