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
shweta kulkarni
NA
7
2.6k
Insert Query problem
May 15 2015 12:01 AM
Hi
I have written query for inserting records in SQL daatbase from datagridview & some comboboxes & textboxes.
But it is given error like null expection was unhandled.
Please help to detect what is wrong in below code.
private void btnsubmit_Click(object sender, EventArgs e)
{
for (int i = 0; i < cnt; i++)
{
String str = "INSERT INTO JOB_Quality_Rating values('" + comboBox1.SelectedItem + "','" + comboBox3.SelectedItem + "','" + textBox1.Text + "','" + cmbtaskno.SelectedItem + "','" + comboBox2.SelectedItem + "','" + dataGridView1.Rows[i].Cells[0].Value.ToString() + "','" + dataGridView1.Rows[i].Cells[1].Value.ToString() + "','" + dataGridView1.Rows[i].Cells[2].Value.ToString() + "','" + txtTotal.Text + "','" + mdlconnection.user_id + "','" + DateTime.Now + "')";
//int d = mdlconnection.excuteQuery(str);
//if (d > 0)
mdlconnection.excuteQuery(str);
{
MessageBox.Show("Job Quality Save sucessfully");
}
}
}
Reply
Answers (
2
)
How to print a gridview column wise in Windows Application?
How to call uc?