Re: OleDb vs. Sql Interoperability

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance



Alex,

Maybe this sample can help you although it looks probably very difficult as
this is your first expirience with AdoNet.

Cor

"Alex Maghen" <AlexMaghen@xxxxxxxxxxxxxxxx> schreef in bericht
news:E7F84D60-43F3-4685-8253-462F1B0296F3@xxxxxxxxxxxxxxxx
Cor -

Thanks for this. I'll admit I don't really understand the Factory concept.
I'll look into it further. One question I *do* have though - it seems like
I
could always return a DataTable object from all of the data objects and
functions I've created instead of returning OleDbDataReaders or
SqlDataReaders. This way, all of my binding, etc. could remain the same
even
if I were to choose to switch between Sql and OleDb, right?

Is this a bad idea? It says in the documentation that a XXXDataReader
object
is more effidient than a DataTable.

Thoughts?

Alex


"Cor Ligthert [MVP]" wrote:

Alex,

This should do what you need, although it is not yet complete in my
opinion.

http://msdn2.microsoft.com/en-us/library/system.data.common.dbproviderfactory.aspx

I hope this helps,

Cor

"Alex Maghen" <AlexMaghen@xxxxxxxxxxxxxxxx> schreef in bericht
news:EE0F0CD2-F333-450B-BC13-AD6D22FF11B0@xxxxxxxxxxxxxxxx
I'm building a lot of ASPX pages and business objects that consume and
interact with database data. Some of this is done with data-binding,
some
is
done with programmatic calls to Stored Procedures, Views, etc.

I've created a DB class that I use to simplify and make consistent my
inteaction with the database, and for all of the aspects of connecting
to
the
database, building the call (query, Stored Procedure, Stored Procedure
with
Parameters, etc.) that works just fine.

But here's my problem: Data that is returned comes back in objects like
XXDataReader (OleDbDataReader or SqlDataReader). If I use one of these
in
my
.aspx Pages, it means I've committed to using either OleDb for my
database
access of SqlClient for my database access. What if I don't want to
have
to
decide? What if I want to set things up so that, if I want to switch
from
a
SqlServer to some other database backend, I can just change my DB
class,
but
not have to touch all of my pages and other objects?

What's the most elegant and prefered way to do this? I know that I
*could*
just use OleDb for everything (including SqlServer), but that seems
like
such
a shame in that I understand that the SqlClient access for SqlServer is
supposed to be *way* more efficient.

Alex






.



Relevant Pages

  • Re: Extended Stored Procedure: Get the current db of the client
    ... with the caveat that you don't recommend it because Microsoft ... of a stored procedure versus umpteen of the same stored procedure spread ... I am not going after Gert Sue. ... the database context as a parameter if you need it, ...
    (microsoft.public.sqlserver.odbc)
  • Trying to set up a SQL Server Agent Account and I hit a wall....
    ... Our database is on SQL Server 2005, however it is set to compatibility mode ... You may need to set the compatibility level ... of the current database to a higher value to enable this feature. ... for the stored procedure sp_dbcmptlevel. ...
    (microsoft.public.sqlserver.security)
  • Re: Extended Stored Procedure: Get the current db of the client
    ... I am not going after Gert Sue. ... the database context as a parameter if you need it, ... Did you ever write an extended stored procedure? ... different than an extended stored procedure, so that is not giving you want ...
    (microsoft.public.sqlserver.odbc)
  • Re: Extended Stored Procedure: Get the current db of the client
    ... Thanks for the link Sue. ... I am not going after Gert Sue. ... the database context as a parameter if you need it, ... Did you ever write an extended stored procedure? ...
    (microsoft.public.sqlserver.odbc)
  • Re: using sp_ as a naming convention for stored procedures
    ... System stored procedures are created and stored in the master ... database and have the sp_ prefix. ... from any database without having to qualify the stored procedure name fully ... SQL Server always looks for a stored procedure ...
    (microsoft.public.sqlserver.programming)