Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8156009
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T16:49:36+00:00 2026-06-06T16:49:36+00:00

Im trying to write the results from a SProc to a textfile. I have

  • 0

Im trying to write the results from a SProc to a textfile. I have 3 scenarios:

  1. SProc takes no parameters.

  2. SProc takes parameters.

  3. SProc takes parameters and there is a loop which increments the parameters.

scenario 1 and 2’s data will be stored in a list since they are most likely to be just a single row of results.

scenario 3’s data will be stored in a data table.

I was thinking of using the factory pattern for this, 3 different classes each implementing a specific interface, and a factory to determine which of the 3 would be required.

The issue is once the method is finished and the completion event has been risen, i need to know what scenario was implemented (datatable vs List) Is this an issue? If so, could someone please explain why + a possible solution?

Note: Just to clarify, this is not a plea of, please write my program.

Thanks very much for your time, i appreciate it.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-06T16:49:38+00:00Added an answer on June 6, 2026 at 4:49 pm

    Whenever you need to know an actual type behind an interface, you might have chosen a wrong point to introduce the interface. This is what it looks like here.

    It looks to me like you want to separate the concern for doing your logic (which produces some data) from the logic of logging the results (in this case to a text file, but there might be other targets, right?). Why not introduce an interface for ResultLogging?

    interface IResultLogger
    {
       void LogList(List<Something> data);
       void LogDataTable(DataTable data);
    }
    

    and pass an instance of this interface to all your methods doing the logic?

    If you don’t want to have the “logging” (calling the IResultLogger interface) inside these methods, you might add another abstraction: The concept of “ResultData”.

    abstract class ResultData
    {
       abstract public void LogToResultLogger();
       //add methods to access the data in a way you might need for other things in your program
    }
    

    and derive a “ListResultData” and “DataTableResultData”.

    I don’t see the value of the factory pattern here.

    Another way of doing it would be to have a

    class ListLogger
    {
       public void LogList(List<Something> data) {}
    }
    

    and

    class DataTableLogger
    {
       public void LogDataTable(DataTable data) {}
    }
    

    and do

    void method1() and method2()
    {
      //do logic
      new ListLogger().LogList(data);
    }
    
    void method3()
    {
      //do logic
      new DataTableLogger().LogDataTable(data);
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have been trying to write a macro (in steps) to organize the results
I'm trying to convert a pretty simple script that takes search results from Twitter
I'm trying to write an iterator for results from a PDO statement but I
I'm trying to write a small Python script that will get query results from
I'm trying to write sql that produces the desired result from the data below.
I am trying to write a MySQL query that gives me results of Organisation
I am trying to cache the results of a query which won't change very
I am trying to write a SQL query that pulls from 3 tables and
I am trying to write a query that grabs information from one database and
I am trying to write a function that will pull valid phone numbers from

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.