Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
C# 2.0 Return DataReader object
Message
Information générale
Forum:
ASP.NET
Catégorie:
Autre
Versions des environnements
Environment:
C# 2.0
Divers
Thread ID:
01537785
Message ID:
01537861
Vues:
38
Do you really need a SqlDataReader or OleDbDataReader?

Why not return the base class DbDataReader or the IDataReader interface from your method and then you can work on either. DataReader typically has no specializations for the specific database dialect it uses so there's nothing gained by explicitly using the specific versions.

+++ Rick ---

>Hi,
>
>I have a method that needs to return either OleDbDataReader or SqlDataReader (depends on the back-end database). Within the method I have IF/ELSE where the code is processed accordingly. But in the method signature I can only specify one type of reader. E.g.
>
>public OleDbDataReader MethodName()
>or
>public SqlDataReader MethodName()
>
>
>Does it mean that I have to split the method into two methods depending on the type of reader I need to return and deal with it at the calling level?
>
>TIA.
+++ Rick ---

West Wind Technologies
Maui, Hawaii

west-wind.com/
West Wind Message Board
Rick's Web Log
Markdown Monster
---
Making waves on the Web

Where do you want to surf today?
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform