i new learner in c# , i have basic understanding in c# , now i try to create a basic program that let user key in input and save in a excel format ,i try found some resurce but dont work , can any oe help me??

What error are you getting? and what code is behind it?

( I havent any c# and excel code to hand, but, logic will prevail)

eee i mean i cannot found any example of c# project that use excel as data base(sorry for the misunderstanding) , all of the c# program mysql. i only know how to use excel only , can u help me? the add new item list dont event have excel , only sql as database

i new learner in c# , i have basic understanding in c# , now i try to create a basic program that let user key in input and save in a excel format ,i try found some resurce but dont work , can any oe help me??

Are you just looking to read and write data back and forth to an Excel compatible file? If so, a simple textwriter/reader would work, such as:

//Create a new TextWriter Object that will append to an existing file
TextWriter w = new StreamWriter(@"c:\filepath\filename.csv", true);
w.WriteLine(<Field A> + "," + <Field B> + "," + ........);
w.Close();

To read the data, you would just create and use a TextReader object. This is a very simplistic way of doing, and I would actually recommend taking it a setp further by using XML if you need to actually manipulate the data in your program. To just get it into a format for Excel, the above will work, however.

HTH

This article has been dead for over six months. Start a new discussion instead.