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
Marvin kakuru
1.4k
356
160.2k
Datagridview
Aug 11 2011 12:16 PM
hi ALL
I am trying to insert data from datagridview to sql, but i only insert one line or one row,
below is the code i am using.
int
row = dataGridView1.Rows.Count-2;
SqlConnection
conn =
new
SqlConnection
(
"Data Source=KATOTO-PC;Initial Catalog =thyfarm;User ID=sa;Password=Kyozi"
);
conn.Open();
string
insertString =
"insert into Treatmentpurchases (day) values ('"
+ dataGridView1.Rows[row].Cells[
"Day"
].Value +
"')"
;
SqlCommand
cmd =
new
SqlCommand
(insertString, conn);
cmd.ExecuteNonQuery();
conn.Close();
any help will be highly appreciated.
Reply
Answers (
1
)
C sharp Constructor
About Built -in Types