CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    Jan 2007
    Posts
    28

    Sample loop code for reading from MySQL, writing to Excel

    Hi Everybody,

    I am writing a simple program which connect MySQL reads each line of a table content and writing to an Excel file line by line. I want the procedure start onClick of a start button. I am quite new to c# and NOT good with the classes etc.

    I need a sample code telling how to create a loop starting from the beginning of MySQL table to the last record and in the loop writes the content of the fields to the Excel file.

    Please do not send a part of a code as I am a rookie and don't understand the half written examples.

    Regards
    telmessos

  2. #2
    Join Date
    Oct 2008
    Location
    Cologne, Germany
    Posts
    756

    Re: Sample loop code for reading from MySQL, writing to Excel

    Quote Originally Posted by telmessos View Post
    I need a sample code telling how to create a loop starting from the beginning of MySQL table to the last record
    I've already showed you how to read each record in your last thread:
    Code:
    while (reader.Read())
    {
       Debug.WriteLine(reader[0] + " -- " + reader[1]); // 0 and 1 because I've got two collumns in my test table
    }
    Quote Originally Posted by telmessos View Post
    and in the loop writes the content of the fields to the Excel file.
    I forgot how to do it

    Quote Originally Posted by telmessos View Post
    Please do not send a part of a code as I am a rookie and don't understand the half written examples.
    so you acctually want us to write your application you need some book or a tutorial I think and learn the basics first.
    win7 x86, VS 2008 & 2010, C++/CLI, C#, .NET 3.5 & 4.0, VB.NET, VBA... WPF is comming

    remeber to give feedback you think my response deserves recognition? perhaps you may want to click the Rate this post link/button and add to my reputation

    private lessons are not an option so please don't ask for help in private, I won't replay

    if you use Opera and you'd like to have the tab-button functionality for the texteditor take a look at my Opera Tab-UserScirpt; and if you know how to stop firefox from jumping to the next control when you hit tab let me know

  3. #3
    Join Date
    Jan 2007
    Posts
    28

    Re: Sample loop code for reading from MySQL, writing to Excel

    Thanks for your advice of reading a book. I already have a tutorial consists of 800 pages. I am clever enough to read and understand if I have time. This is a quick code needs to be finished before tomorrow and I have to finish it for now. In the future definitely I am planning to work on the tutorials etc.

    Still, what I need is not anybody write my application. Let's say there's sth like Debug.Write on your code. I don't know what debug is and as soon as I paste it to my Visual c#, gives an error message. If it was ASP, I know how to create such a loop to create. On this example I don't know what to write. I need to see a whole code with all objects are defined. I am not completely a stranger to programming. With some detailed help I can understand where to put what...

    Anyway thank you
    telmessos

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured