ExecuteNonQuery() says I have bad SQL

  • Thread starter Thread starter SteveK
  • Start date Start date
S

SteveK

Here is the SQL statement that I'm trying to execute
INSERT INTO Tbl_NameCharacter(Character, Code) VALUES('Rebel Generic',
'Rbl')


My database has a table name 'Tbl_NameCharacter'
it has 3 fields, the PK is an autonumber 'CharacterID'
the second is a 'text' field named 'Character'
and the third is also a 'text' field named 'Code'

I don't get it.

Here are the details from the OleDbException
System.Object {System.Data.OleDb.OleDbError} System.Object
Message "Syntax error in INSERT INTO statement." string
message "Syntax error in INSERT INTO statement." string
NativeError -529993134 int
nativeError -529993134 int
Source "Microsoft JET Database Engine" string
source "Microsoft JET Database Engine" string
SQLState "3000" string
sqlState "3000" string



Any ideas?
 
Try this:
INSERT INTO Tbl_NameCharacter([Character],
Code:
) VALUES('Rebel Generic',
'Rbl')

--
____________________________________
William (Bill) Vaughn
Author, Mentor, Consultant
Microsoft MVP
www.betav.com
Please reply only to the newsgroup so that others can benefit.
This posting is provided "AS IS" with no warranties, and confers no rights.
__________________________________
 
that was it, thank Bill.

I guess Character is a reserved word. Hmm. ;)



William (Bill) Vaughn said:
Try this:
INSERT INTO Tbl_NameCharacter([Character],
Code:
) VALUES('Rebel Generic',
'Rbl')

--
____________________________________
William (Bill) Vaughn
Author, Mentor, Consultant
Microsoft MVP
www.betav.com
Please reply only to the newsgroup so that others can benefit.
This posting is provided "AS IS" with no warranties, and confers no rights.
__________________________________

[QUOTE="SteveK"]
Here is the SQL statement that I'm trying to execute
INSERT INTO Tbl_NameCharacter(Character, Code) VALUES('Rebel Generic',
'Rbl')


My database has a table name 'Tbl_NameCharacter'
it has 3 fields, the PK is an autonumber 'CharacterID'
the second is a 'text' field named 'Character'
and the third is also a 'text' field named 'Code'

I don't get it.

Here are the details from the OleDbException
System.Object {System.Data.OleDb.OleDbError} System.Object
Message "Syntax error in INSERT INTO statement." string
message "Syntax error in INSERT INTO statement." string
NativeError -529993134 int
nativeError -529993134 int
Source "Microsoft JET Database Engine" string
source "Microsoft JET Database Engine" string
SQLState "3000" string
sqlState "3000" string



Any ideas?
[/QUOTE]
[/QUOTE]
 
Ah... yup.

--
____________________________________
William (Bill) Vaughn
Author, Mentor, Consultant
Microsoft MVP
www.betav.com
Please reply only to the newsgroup so that others can benefit.
This posting is provided "AS IS" with no warranties, and confers no rights.
__________________________________

SteveK said:
that was it, thank Bill.

I guess Character is a reserved word. Hmm. ;)



William (Bill) Vaughn said:
Try this:
INSERT INTO Tbl_NameCharacter([Character],
Code:
) VALUES('Rebel
Generic',
'Rbl')

--
____________________________________
William (Bill) Vaughn
Author, Mentor, Consultant
Microsoft MVP
www.betav.com
Please reply only to the newsgroup so that others can benefit.
This posting is provided "AS IS" with no warranties, and confers no rights.
__________________________________

[QUOTE="SteveK"]
Here is the SQL statement that I'm trying to execute
INSERT INTO Tbl_NameCharacter(Character, Code) VALUES('Rebel Generic',
'Rbl')


My database has a table name 'Tbl_NameCharacter'
it has 3 fields, the PK is an autonumber 'CharacterID'
the second is a 'text' field named 'Character'
and the third is also a 'text' field named 'Code'

I don't get it.

Here are the details from the OleDbException
System.Object {System.Data.OleDb.OleDbError} System.Object
Message "Syntax error in INSERT INTO statement." string
message "Syntax error in INSERT INTO statement." string
NativeError -529993134 int
nativeError -529993134 int
Source "Microsoft JET Database Engine" string
source "Microsoft JET Database Engine" string
SQLState "3000" string
sqlState "3000" string



Any ideas?
[/QUOTE]
[/QUOTE]
[/QUOTE]
 
I am having the same issue and my fields are date, child, activity,
starttime, and endtime? Are any of these reserved words?

William (Bill) Vaughn said:
Ah... yup.

--
____________________________________
William (Bill) Vaughn
Author, Mentor, Consultant
Microsoft MVP
www.betav.com
Please reply only to the newsgroup so that others can benefit.
This posting is provided "AS IS" with no warranties, and confers no rights.
__________________________________

SteveK said:
that was it, thank Bill.

I guess Character is a reserved word. Hmm. ;)



William (Bill) Vaughn said:
Try this:
INSERT INTO Tbl_NameCharacter([Character],
Code:
) VALUES('Rebel
Generic',
'Rbl')

--
____________________________________
William (Bill) Vaughn
Author, Mentor, Consultant
Microsoft MVP
www.betav.com
Please reply only to the newsgroup so that others can benefit.
This posting is provided "AS IS" with no warranties, and confers no rights.
__________________________________

Here is the SQL statement that I'm trying to execute
INSERT INTO Tbl_NameCharacter(Character, Code) VALUES('Rebel Generic',
'Rbl')


My database has a table name 'Tbl_NameCharacter'
it has 3 fields, the PK is an autonumber 'CharacterID'
the second is a 'text' field named 'Character'
and the third is also a 'text' field named 'Code'

I don't get it.

Here are the details from the OleDbException
System.Object {System.Data.OleDb.OleDbError} System.Object
Message "Syntax error in INSERT INTO statement." string
message "Syntax error in INSERT INTO statement." string
NativeError -529993134 int
nativeError -529993134 int
Source "Microsoft JET Database Engine" string
source "Microsoft JET Database Engine" string
SQLState "3000" string
sqlState "3000" string



Any ideas?
[/QUOTE]
[/QUOTE]
[/QUOTE]
 
List of Microsoft Jet 4.0 reserved words

http://support.microsoft.com/default.aspx?scid=kb;EN-US;321266

This list includes Date

Tom Nowak said:
I am having the same issue and my fields are date, child, activity,
starttime, and endtime? Are any of these reserved words?

William (Bill) Vaughn said:
Ah... yup.

--
____________________________________
William (Bill) Vaughn
Author, Mentor, Consultant
Microsoft MVP
www.betav.com
Please reply only to the newsgroup so that others can benefit.
This posting is provided "AS IS" with no warranties, and confers no
rights.
__________________________________

SteveK said:
that was it, thank Bill.

I guess Character is a reserved word. Hmm. ;)



Try this:
INSERT INTO Tbl_NameCharacter([Character],
Code:
) VALUES('Rebel
Generic',
'Rbl')

--
____________________________________
William (Bill) Vaughn
Author, Mentor, Consultant
Microsoft MVP
www.betav.com
Please reply only to the newsgroup so that others can benefit.
This posting is provided "AS IS" with no warranties, and confers no
rights.
__________________________________

Here is the SQL statement that I'm trying to execute
INSERT INTO Tbl_NameCharacter(Character, Code) VALUES('Rebel
Generic',
'Rbl')


My database has a table name 'Tbl_NameCharacter'
it has 3 fields, the PK is an autonumber 'CharacterID'
the second is a 'text' field named 'Character'
and the third is also a 'text' field named 'Code'

I don't get it.

Here are the details from the OleDbException
System.Object {System.Data.OleDb.OleDbError} System.Object
Message "Syntax error in INSERT INTO statement." string
message "Syntax error in INSERT INTO statement." string
NativeError -529993134 int
nativeError -529993134 int
Source "Microsoft JET Database Engine" string
source "Microsoft JET Database Engine" string
SQLState "3000" string
sqlState "3000" string



Any ideas?
[/QUOTE]
[/QUOTE][/QUOTE]
 
Back
Top