TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
hasib budi
NA
20
5.2k
open csv one by one using loop
Sep 17 2020 3:27 AM
hi,
I have a program that can read CSV. How to make it loop to read CSV file and insert. Example one folder has 2 CSV file. The program will read 1.csv and insert. And then 2.csv and then insert. Please help me.
DirectoryInfo info =
new
DirectoryInfo(@
"C:\folder\apoo"
);
FileInfo[] filess = info.GetFiles().OrderByDescending(p => p.LastWriteTime).ToArray();
string
latestfile =
""
;
DateTime lastupdate = DateTime.MinValue;
var connString =
"path"
;
foreach
(FileInfo filess2
in
filess)
{
if
(filess2.LastWriteTime > lastupdate)
{
lastupdate = filess2.LastWriteTime;
latestfile = filess2.Name;
}
Console.WriteLine(
"File : "
+ latestfile);
Console.WriteLine(
"LWT : "
+lastupdate);
}
Reply
Answers (
1
)
Image copy from one network path onto another network path with
How to move data from datatable to CSV