Syntax error in Update stament

B

Brad Allison

Okay, everything seemed to be working fine yesterday. Took the program home
to work on (changing the data connection to accomodate working at home),
brought the program back this morning, changed the data connection back.
Now when trying to Update, I get an error "Syntax Error in Update command".
From here I have deleted the connection, the data adapter, the dataset and
rebuilt everything. Still getting the same error. By the way, I am using
the wizard to create these connections and commands. Checking the SQL
syntax on UPDATE, it does give me the error and it also gives me and error
on the INSERT command; however the DELETE command seems to work.

Here is the UPDATE command:

UPDATE Scheduling
SET EventID = ?, EventDate = ?, ClubID = ?, Club = ?, Activity
= ?, Show = ?, ClubCity = ?, ClubState = ?, Notes = ?, Weekend = ?, ClubColl
= ?, Year = ?,
AppRcvd = ?, AppSent = ?, LicSent = ?
WHERE (EventID = ?) AND (Activity = ? OR
? IS NULL AND Activity IS NULL) AND (AppRcvd = ? OR
? IS NULL AND AppRcvd IS NULL) AND (AppSent = ? OR
? IS NULL AND AppSent IS NULL) AND (Club = ? OR
? IS NULL AND Club IS NULL) AND (ClubCity = ? OR
? IS NULL AND ClubCity IS NULL) AND (ClubColl = ? OR
? IS NULL AND ClubColl IS NULL) AND (ClubID = ? OR
? IS NULL AND ClubID IS NULL) AND (ClubState = ? OR
? IS NULL AND ClubState IS NULL) AND (EventDate = ? OR
? IS NULL AND EventDate IS NULL) AND (LicSent = ? OR
? IS NULL AND LicSent IS NULL) AND (Notes = ? OR
? IS NULL AND Notes IS NULL) AND (Show = ? OR
? IS NULL AND Show IS NULL) AND (Weekend = ? OR
? IS NULL AND Weekend IS NULL) AND (Year = ? OR
? IS NULL AND Year IS NULL)

Here is the INSERT command:

INSERT INTO Scheduling
(EventID, EventDate, ClubID, Club, Activity, Show,
ClubCity, ClubState, Notes, Weekend, ClubColl, Year, AppRcvd, AppSent,
LicSent)
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)

If anybody has any suggestions I would greatly appreciate it as I have been
beating my head against the wall all morning.

Other information: These are OleDB commands using Access as the data store.

Brad
 
B

Brad Allison

Addendum: Fearing that I was using a sacred reserved word somewhere, I
renamed all of the column names to a name that I know would not be a
reserved word and now all seem to work fine.

Brad
 
B

Brad Allison

Yep, the reserved word was the culprit. And also thanks for the link to the
article. I am printing it and I will commit this to memory.

Brad


William Ryan eMVP said:
YOu have at least one Access reserved word "Year"
http://www.knowdotnet.com/articles/reservedwords.html
either wrap it in [Year] like this or better yet, change it. In all
likelihood you'll forget in the future or someone else will
Brad Allison said:
Okay, everything seemed to be working fine yesterday. Took the program home
to work on (changing the data connection to accomodate working at home),
brought the program back this morning, changed the data connection back.
Now when trying to Update, I get an error "Syntax Error in Update command".
From here I have deleted the connection, the data adapter, the dataset and
rebuilt everything. Still getting the same error. By the way, I am using
the wizard to create these connections and commands. Checking the SQL
syntax on UPDATE, it does give me the error and it also gives me and error
on the INSERT command; however the DELETE command seems to work.

Here is the UPDATE command:

UPDATE Scheduling
SET EventID = ?, EventDate = ?, ClubID = ?, Club = ?, Activity
= ?, Show = ?, ClubCity = ?, ClubState = ?, Notes = ?, Weekend = ?, ClubColl
= ?, Year = ?,
AppRcvd = ?, AppSent = ?, LicSent = ?
WHERE (EventID = ?) AND (Activity = ? OR
? IS NULL AND Activity IS NULL) AND (AppRcvd = ? OR
? IS NULL AND AppRcvd IS NULL) AND (AppSent = ? OR
? IS NULL AND AppSent IS NULL) AND (Club = ? OR
? IS NULL AND Club IS NULL) AND (ClubCity = ? OR
? IS NULL AND ClubCity IS NULL) AND (ClubColl = ? OR
? IS NULL AND ClubColl IS NULL) AND (ClubID = ? OR
? IS NULL AND ClubID IS NULL) AND (ClubState = ? OR
? IS NULL AND ClubState IS NULL) AND (EventDate =
?
OR
? IS NULL AND EventDate IS NULL) AND (LicSent = ? OR
? IS NULL AND LicSent IS NULL) AND (Notes = ? OR
? IS NULL AND Notes IS NULL) AND (Show = ? OR
? IS NULL AND Show IS NULL) AND (Weekend = ? OR
? IS NULL AND Weekend IS NULL) AND (Year = ? OR
? IS NULL AND Year IS NULL)

Here is the INSERT command:

INSERT INTO Scheduling
(EventID, EventDate, ClubID, Club, Activity, Show,
ClubCity, ClubState, Notes, Weekend, ClubColl, Year, AppRcvd, AppSent,
LicSent)
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)

If anybody has any suggestions I would greatly appreciate it as I have been
beating my head against the wall all morning.

Other information: These are OleDB commands using Access as the data store.

Brad
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top