Re: Syntax error in insert statement?



Hi,

Te reason for this error is that Name is a reserved word. You should wrap it
into square brackets.

insert into BusDataObject (View_ID, [Name], NameSpace) Values (?, ?, ?);

And never use concatenation to build queries as suggested in another post

--
Val Mazur
Microsoft MVP

http://xport.mvps.org



"dkocur" <dkocur@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:45B7B545-F78B-41D0-AC2C-0EA0A006F33C@xxxxxxxxxxxxxxxx
> "insert into BusDataObject (View_ID, Name, NameSpace) Values (?, ?, ?);"
>
> results in "Incorrect syntax near '?'."
>
> I'm using C# Express Beta 1 with SQL Server. I know it has to be
> something
> simple, but I just can't figure it out.


.



Relevant Pages

  • Re: Trouble with a specific table name
    ... I would also try enclosing the name in square brackets, ... We have this database that's been around forever, and in recent SQL Server ... Queries that should return almost ...
    (microsoft.public.sqlserver.server)
  • Re: need help with a sql statement
    ... Part of what has me confused is you say 'combine the tables' but the queries ... Access will put subqueries inside square brackets, ... special characters in fieldnames: you must use square brackets to use the ... and you must NOT use square brackets for the subquery. ...
    (microsoft.public.access.forms)
  • Re: Date fields
    ... string that looks like '2006-12-31' using concatenation and whatever other ... If you are going to do a lot of queries based on date, ... We have a legacy file that we're accessing via SQL. ...
    (comp.sys.ibm.as400.misc)
  • Re: need help with a sql statement
    ... They can be used in textboxes, macros, VBA, queries. ... Access will put subqueries inside square brackets, ...
    (microsoft.public.access.forms)
  • Re: Date fields
    ... However, when I query against it using, say, select XDATE from PFILE ... string that looks like '2006-12-31' using concatenation and whatever other ... the SQL is not all that clean and queries are unlikely to ...
    (comp.sys.ibm.as400.misc)

Loading