|
-
January 7th, 2010, 06:57 AM
#1
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
-
January 7th, 2010, 07:22 AM
#2
Re: Sample loop code for reading from MySQL, writing to Excel
 Originally Posted by telmessos
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
}
 Originally Posted by telmessos
and in the loop writes the content of the fields to the Excel file.
I forgot how to do it 
 Originally Posted by telmessos
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
-
January 7th, 2010, 07:45 AM
#3
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|