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:
01537830
Vues:
23
>>>>I understand. We work in different languages (C# and VB.NET). But in your case, if I understand correctly the "As Boolean" means that your method returns the Boolean type, right? So my understanding is that if I apply your code (in the previous message) you method declaration would be like:
>>>>
>>>>
>>>>public Function MethodName( parameters) as oDataRead
>>>>
>>>>
>>>>But now that I look at it does not sound/look right. I need to read on this more.
>>>
>>>The boolean is simply the success of the operation. Each method returns True or False. True means everything went as expected.
>>>
>>>I still believe that the only parameter should be the SQL command, such as lcSQL. Then, your class should handle it all. Basically, you need to focus on the client side not being affected if you change your backend. Thus, in your class, I assume this is an external DLL to your client application, such as a framework, you will isolate all the required backend code in it and the related components so you wouldn't have to deal with that at all even if you change the backend.
>>
>>I don't really have a framework. Let me describe what my code does.
>>
>>User enters some values (in a couple of textbox controls) of an .aspx page.
>>The C# code behind the page calls a method of a BIZ Class (I call it business class but I am not sure if it is technically so).
>>Anyway, the method of the BIZ class creates connection and get a data reader object based on the parameters passed (user entry).
>>The Data Reader is then returned from the BIZ class method to the page code behind and the values of the Data Reader are used in the Code Behind.
>>
>>So my challenge was/is that the BIZ class method should return a data reader but either OleDb type or SQL Server type (depending on the back end).
>>
>>Hopefully my explanation makes sense.
>
>You need to close DataReader right away after you finished working with it - this is important.

I know that. But now I am thinking of changing from using Data Reader to using Data Set. It might be a bit more time to get the data into the DataSet but I think my code will be "cleaner.". Plus in this case the Data Reader or Data Set will only have one row or nothing. So the speed should not be an issue.
"The creative process is nothing but a series of crises." Isaac Bashevis Singer
"My experience is that as soon as people are old enough to know better, they don't know anything at all." Oscar Wilde
"If a nation values anything more than freedom, it will lose its freedom; and the irony of it is that if it is comfort or money that it values more, it will lose that too." W.Somerset Maugham
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform