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
natchaya khamkuna
NA
31
23.5k
I don't know how to import text file to datagridview then edit afterthat write to database with Linq.
Jun 26 2011 3:00 AM
Hello friend and expert ,
I have text file like this 48200120420110830I around 5000 record . The text file from bar code swipe machine.
The 48200 stand for
employee code
, 12042011 stand for
12 April 2011
, 0830 stand for
time 08:30 AM
and I stand for
In/Out ,I=In
I coding to get this text file by stream reader as code below
openFileDialog1.FileName = "";
openFileDialog1.Filter = "Text Files(*.txt)|*.txt";
if(openFileDialog1.ShowDialog() == DialogResult.OK) {
label1.Text = openFileDialog1.FileName;
StreamReader sr = new StreamReader(openFileDialog1.FileName);
After read the text file I would like to write the text file to
Datagridview
before write to
Database.
I design table in database like this.
Emp_code nvarchar(2),
Morning_IN datetime,
Morning_Out datetime,
Afternoon_In datetime,
Afternoon_Out datetime,
Evening_IN datetime,
Evening_Out datetime
But I so confusing and I have question to asking for help as below.
1) How can I I write the text file (5000 record ) to
Datagridview
as my database table design ? Because the text file format
have a lot of duplicate employee code ? ( please forgive me if I not a good explain )
Emp_code Morning_IN Morning_Out Afternoon_In Afternoon_Out Evening_In Evening_Out
2) I intend to use the
Linq to SQL classes
. Please teach me how to write the text file to Datagridview and then can allow to edit data at Datagridview. After that click at the button to save to database .
Anyone help me please and this will me the most appreciated.
Pang Foon (Thailand )
Reply
Answers (
6
)
C#.net 2008 using database diagrams in database designer
Executing a program at a specific time?