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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T21:31:50+00:00 2026-05-16T21:31:50+00:00

I have that code: string pathToSave = Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory); string file = pathToSave + \\

  • 0

I have that code:

string pathToSave = Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory);
            string file = pathToSave + "\\" + "produkty_" + lang + ".csv";
            FileStream fs = new FileStream(file, FileMode.Create);
            StreamWriter sw = new StreamWriter(fs);
           // sw.WriteLine("id;Akt. 1/0;nazwa;kateg.;cena netto;stawka pod;cen suger.;wyprz.;o;d;d;nr kat.;dostępne od:;prod.;ilość;opis skróc;opis;konserwacja");

            OdbcCommand Qry = new OdbcCommand(query, con);
            OdbcDataReader dataReader = Qry.ExecuteReader();

            while (dataReader.Read())
            {
                //SELECT p.COUNTER, p.AKT, p.NAZWA, p.KATEGORIA, p.CENA_NETTO, p.STAWKA_VAT, 
                //p.CENA_SUGEROWANA, p.WYPRZ, p.O, p.COSTAM, p.D1, p.D2, p.NR_KAT, 
                //p.DOSTEPNE_OD, p.COSTAM2, p.PROD, p.COSTAM3, p.COSTAM4, p.COSTAM5, p.ILOSC, p.OPIS_SKRO, p.COMPOS, p.CONSERV

                string counter         = String.Empty;
                string AKT             = String.Empty;
                string NAZWA           = String.Empty;
                string KATEGORIA       = String.Empty;
                string CENA_NETTO      = String.Empty;
                string STAWKA_VAT      = String.Empty;
                string CENA_SUGEROWANA = String.Empty;
                string WYPRZ           = String.Empty;
                string COSTAM          = String.Empty;
                string D1              = String.Empty;
                string D2              = String.Empty;
                string NR_KAT          = String.Empty;
                string DOSTEPNE_OD     = String.Empty;
                string COSTAM2         = String.Empty;
                string PROD            = String.Empty;
                string COSTAM3         = String.Empty;
                string COSTAM4         = String.Empty;
                string COSTAM5         = String.Empty;
                string ILOSC           = String.Empty;
                string OPIS_SKRO       = String.Empty;
                string COMPOS          = String.Empty;
                string CONSERV         = String.Empty;

                counter = dataReader["COUNTER"].ToString();
                AKT = dataReader["AKT"].ToString();
                NAZWA = dataReader["NAZWA"].ToString();
                KATEGORIA = dataReader["KATEGORIA"].ToString();
                CENA_NETTO = dataReader["CENA_NETTO"].ToString();
                STAWKA_VAT = dataReader["STAWKA_VAT"].ToString();
                CENA_SUGEROWANA = dataReader["CENA_SUGEROWANA"].ToString();
                WYPRZ = dataReader["WYPRZ"].ToString();
                COSTAM = dataReader["COSTAM"].ToString();
                D1 = dataReader["D1"].ToString();
                D2 = dataReader["D2"].ToString();
                NR_KAT = dataReader["NR_KAT"].ToString();
                DOSTEPNE_OD = dataReader["DOSTEPNE_OD"].ToString();
                COSTAM2 = dataReader["COSTAM2"].ToString();
                PROD = dataReader["PROD"].ToString();
                COSTAM3 = dataReader["COSTAM3"].ToString();
                COSTAM4 = dataReader["COSTAM4"].ToString();
                COSTAM5 = dataReader["COSTAM5"].ToString();
                ILOSC = dataReader["ILOSC"].ToString();
                OPIS_SKRO = dataReader["OPIS_SKRO"].ToString();
                COMPOS = dataReader["COMPOS"].ToString();
                CONSERV = dataReader["CONSERV"].ToString();
                //if (COMPOS.Contains(@"\"))
                //{
                //    COMPOS = "";
                //}
                StreamWriter wr = new StreamWriter(@"c:\kan\fileOuput1.txt", true);
                wr.WriteLine(
                counter + ";" +
                AKT + ";" +
                NAZWA + ";" +
                KATEGORIA + ";" +
                CENA_NETTO + ";" +
                STAWKA_VAT + ";" +
                CENA_SUGEROWANA + ";" +
                WYPRZ + ";" +
                COSTAM + ";" +
                D1 + ";" +
                D2 + ";" +
                NR_KAT + ";" +
                DOSTEPNE_OD + ";" +
                COSTAM2 + ";" +
                PROD + ";" +
                COSTAM3 + ";" +
                COSTAM4 + ";" +
                COSTAM5 + ";" +
                ILOSC + ";" +
                OPIS_SKRO + ";" +
                COMPOS + ";" +
               CONSERV + ";"
               );
                wr.Close();

And when I save it to csv file in COMPOS and CONSERV I get some garbage data, looks like combination of some fields etc :/ Do You have any idea why it’s happens? And this take place for some rows, not always …

  • 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-16T21:31:50+00:00Added an answer on May 16, 2026 at 9:31 pm

    Here are some things you can try:

    • Try checking these rows in the DB. Are they valid?
    • Do they have any special characters that are messing up the fields?
    • Debug the datareader object itself to check if the data was properly fetched, if not check your query.
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have two string variables which are both file paths. The code that worked
Hi I have some code that uses block RandomAccessFile file = new RandomAccessFile(some file,
I have code that generates a List<string[]> variable but can't quite figure out how
I have code that looks something like, #include<stdlib.h> #include<string.h> char** someArray = NULL; size_t
I have this code that makes a string and then echos the loop out
I have some code that looks like: static const std::string and( AND ); This
i have this code that will check the array contains the specific string and
I have a property in my backing bean that returns html code: public String
I have a Func in my code that's declared like this: Func<string, int, bool>
I have a C# string object that contains the code of a generic method,

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.