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
james james
NA
419
29.8k
Insert data into database error
Oct 21 2017 9:23 AM
I am getting an error while inserting data.
The error is "Number of query values and destination fields are not the same".
I have read alot about ppl missing some single qoutes but I must be overlooking them.
My code :
private void btn_Insert_Click(object sender, EventArgs e)
{
con.Open();
OleDbCommand cmd = con.CreateCommand();
cmd.CommandType = CommandType.Text;
cmd.CommandText = "insert into Table values('" + txt_Date + "','" + txt_Units + "','" + txt_TimeOrd + "','" + txtTimeRec + "','" + txt_Panel + "', '" + txt_Box +"','" + txt_Name + "', '" + txt_Notes +"')";
cmd.ExecuteNonQuery();
con.Close();
MessageBox.Show("Record inserted Successfully");
}
}
}
Reply
Answers (
5
)
Implementation of DHTMLX / DayPoilet or FullCalendar
Asp.net MVC 5 or Asp.net core MVC