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 6978025
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T17:42:09+00:00 2026-05-27T17:42:09+00:00

I have the following scenario: I have five fields in my database (name, email,

  • 0

I have the following scenario: I have five fields in my database (name, email, address etc) and then another n fields which are user defined, for instance I can add custom fields such as ID Number, Blood type or anything for that matter and as many of them as I like. I now need to put this into a CSV file. However the problem is that now all of the fields are required therefore I cannot just add the headers to the CSV file and then sequentially add the data as the data might not be in the correct column. What I would need to do is something along the lines of this:

  1. Add the predefined headers

  2. Add the rest of the custom headers

  3. Add the predefined data

  4. Add the custom data

My problem is step 4. What I would need is to be able to add the data to a specified column, and I cannot seem to find out how to do this in KBCSV.

What I am currently doing is:

List<string> data = new List<string>();
//Add all predefined data to the data object
foreach (CustomDataItem cdi in CustomData)
{
    data.Add(cdi.Value);
}
writer.WriteDataRecord(data);
//writer is a Kent.Boogaart.KBCsv.CsvWriter

The problem with this approach is that the CustomData length and the csv header length could not match up, meaning I will have values in the wrong columns. Is there any way to add a data value to a specified column?

  • 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-05-27T17:42:10+00:00Added an answer on May 27, 2026 at 5:42 pm

    why not use a dictionary here, and then when writing in csv file check if key is present for the coreect sequence column in dictionary

      Dictionary<string, string> data = new Dictionary<string, string>();
            //Add all predefined data to the data object 
            foreach (CustomDataItem cdi in CustomData)
            {
                data.Add(cdi.ColumnName, cdi.Value);
            } 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following scenario: Entities are loaded from the database. One of them
I have following Scenario: PHP(Server, Writer) ----> MySQL Database <------ PHP(Client, Reader/ Writer); PHPS
I have the following scenario: <xsl:variable name=var1 select='SOME_DATA1' /> <xsl:if test='some_condition'> <xsl:variable name=var2 >
I have the following scenario: A user on one our customer's website clicks a
I have the following scenario: An SQL 2000 database with a table containing the
I have following scenario: alt text http://static.zooomr.com/images/7579022_e64808b855_o.png We have a WebService which poses as
I have the following scenario: I have a database with a particular MyISAM table
I have the following scenario: A user shelves some changes. Time goes by and
Have the following scenario. I have a few form, which essentially have a few
I have the following scenario: 1 List which contains the months of the year:

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.