Further to what
@Sheepings said, one of the most important lessons that a developer can learn is to break their problem down into parts and then tackle each part individually. That's problem-solving 101 really - divide and conquer - but it certainly applies to software development. To start with, a CSV file is simply a text file. Do you know how to write to a text file in C#? If not, that's the first thing to research. Once you can do that, then you can think about how to get the text you want to write from your
DataTable
. Do you know how to get data from a
DataTable
? If not, research that. Once you do know, then you can think about how to format it in the manner you need. Do you know how to format text? If not, research that. Etc.
People seem to think that they should be able to write code for the exact combination of problems they have in front of them without understanding any of the subjects involved. They shouldn't. They should understand the subjects first. In order to do that, they need to understand what those subjects are. That's where the analysis part of the problem comes in. You need to analyse the problem first, then research. There's no rule that says that you can't practice and test various simpler things in an effort to build up to the full solution you need. In fact, there should be a rule that you have to. Many people - especially beginners - think that if they can't write all the code to do exactly what they need then they should come to a screaming halt until someone else gives them the exact code. That's not how it works. Break it down into parts, research and test the parts that you can and then ask only specific questions about those parts that you have tried but failed to solve for yourself, then put all the partial solutions together to solve the original problem.
That is what software development is. That's what we all do on the complex enterprise applications we work on and the sooner that a beginner learns that, the sooner they become the best developer they can be. Very few people understand this at first, so I'm not necessarily criticising you for not knowing either. Now that you do know though, that's what you should strive to do. We will be more than happy to help with the parts that you can't work out, but we would like to see you work out what those parts actually are.