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
Re: Sample loop code for reading from MySQL, writing to Excel
Quote:
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
}
Quote:
Originally Posted by
telmessos
and in the loop writes the content of the fields to the Excel file.
I forgot how to do it :cry:
Quote:
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 :D you need some book or a tutorial I think and learn the basics first.
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