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
Guest User
Tech Writer
77
13.9k
read csv file and save it to database
Jul 20 2020 2:05 AM
hi, wanna ask
how to read from CSV file and save it to database row by row.
In the code below, it will open the CSV file and read the data row by row.
foreach (string path in Directory.EnumerateFiles(@"C:\ipub\root", "*.csv"))
{
string[] lines = System.IO.File.ReadAllLines(path);
foreach (string line in lines)
{
Console.WriteLine(line);
}
}
how to change this code, so that after it opens the CSV file and then read row by row after that save it to database.
Or there have another way to do it
thank you
I using visual studio 2019, c#
Reply
Answers (
2
)
Interview question 1 - Better way to write the below code
How to fill missing Data