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
David Smith
NA
2k
0
Sql semicolon Access MDB error
Dec 5 2012 6:30 PM
I am getting an error saying missing semicolon in the SQL statement. I writing to an access database. Review below.
string sql = "INSERT INTO tblServiceEvent ( ServiceID, ContactID, NieghborID,ContactFrom,ContactAbout, " +
"ServiceEventDate, ServiceEventType, ServiceEventStatus, ServiceEvent,TakenByID, FollowUpDate, " +
"FollowUpDate,CompleteByID, CompleteDate, Comments, SysCreateBy, SysCreateDate, SysUpdateBy, SysUpdateDate ) " +
"VALUES ( ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) Where ServiceID = ? ;";
using (OleDbConnection sqlConnection = new OleDbConnection(Properties.Settings.Default.careuser2_5cXPConnectionString))
{
sqlConnection.Open();
OleDbDataAdapter sqlCommandAdapter = new OleDbDataAdapter();
using (OleDbCommand sqlCommand = new OleDbCommand(sql, sqlConnection))
{
sqlCommand.Parameters.AddWithValue("ServiceID", ServiceID);
sqlCommand.Parameters.AddWithValue("ContactID", ContactID);
sqlCommand.Parameters.AddWithValue("NieghborID", NieghborID);
sqlCommand.Parameters.AddWithValue("ContactFrom", ContactFrom);
sqlCommand.Parameters.AddWithValue("ContactAbout", ContactAbout);
sqlCommand.Parameters.AddWithValue("ServiceEventDate", ServiceEventDate);
sqlCommand.Parameters.AddWithValue("ServiceEventType", ServiceEventType);
sqlCommand.Parameters.AddWithValue("ServiceEventStatus", ServiceEventStatus);
sqlCommand.Parameters.AddWithValue("ServiceEvent", ServiceEvent0);
sqlCommand.Parameters.AddWithValue("FollowUpDate", FollowUpDate);
sqlCommand.Parameters.AddWithValue("CompleteByID", CompleteByID);
sqlCommand.Parameters.AddWithValue("CompleteDate", CompleteDate);
sqlCommand.Parameters.AddWithValue("Comments", Comments);
sqlCommand.Parameters.AddWithValue("SysCreateBy", SysCreateBy);
sqlCommand.Parameters.AddWithValue("SysCreateDate", SysCreateDate);
sqlCommand.Parameters.AddWithValue("SysUpdateDate", SysUpdateDate);
sqlCommand.Parameters.AddWithValue("SysUpdateDate", SysUpdateDate);
sqlCommandAdapter.UpdateCommand = sqlCommand;
int rowsAffected = 0;
if ((rowsAffected = sqlCommandAdapter.UpdateCommand.ExecuteNonQuery()) > 0)
Reply
Answers (
0
)
The runtime has encountered a fatal error
how to get wallpaper download count in my website?