When I run an SQL statement with ADO.NET it gives me this error:

System.Data.OleDb.OleDbException: Syntax error in INSERT INTO statement.
at System.Data.OleDb.OleDbCommand.ExecuteCommandTextErrorHandling(Int32
hr)
at
System.Data.OleDb.OleDbCommand.ExecuteCommandTextForSingleResult(tagDBPARAMS
dbParams, Object& executeResult)
at System.Data.OleDb.OleDbCommand.ExecuteCommandText(Object&
executeResult)
at System.Data.OleDb.OleDbCommand.ExecuteCommand(CommandBehavior
behavior, Object& executeResult)
at System.Data.OleDb.OleDbCommand.ExecuteReaderInternal(CommandBehavior
behavior, String method)
at System.Data.OleDb.OleDbCommand.ExecuteNonQuery()
at DMSI.SqlHelper.ExecuteSql(String strSql, String strCnnString) in
c:\inetpub\wwwroot\DMSI\SqlHelper.vb:line 9

When I copy/paste the SQL directly into an Access query and run it it runs
PERFECT.

Here's the SQL:

INSERT INTO
Employees(EmployeeId,TitleId,FirstName,MiddleInitial,LastName,Address,City,S
tate,Zip,CellPhone,Fax,EmailAddress,UserName,Password,RegionalDirectorId)
VALUES(8,3,'c','c','c','c','c','c','c','c','c','c','c','c',6);

Ideas?

Thanks!

Re: SQL syntax error??? by Marina

Marina
Wed Aug 18 13:20:42 CDT 2004

I believe 'Password' is a reserved word. You shouldn't name your column with
reserved word names, as this kind of thing tends to happen.

If this is indeed the problem (you didn't actually post any of your code),
try putting Password in '[' and ']' to see if that helps.

"VB Programmer" <Dont*NoSpam-Please*@jEmail.com> wrote in message
news:uzN%2317UhEHA.3076@tk2msftngp13.phx.gbl...
> When I run an SQL statement with ADO.NET it gives me this error:
>
> System.Data.OleDb.OleDbException: Syntax error in INSERT INTO statement.
> at System.Data.OleDb.OleDbCommand.ExecuteCommandTextErrorHandling(Int32
> hr)
> at
>
System.Data.OleDb.OleDbCommand.ExecuteCommandTextForSingleResult(tagDBPARAMS
> dbParams, Object& executeResult)
> at System.Data.OleDb.OleDbCommand.ExecuteCommandText(Object&
> executeResult)
> at System.Data.OleDb.OleDbCommand.ExecuteCommand(CommandBehavior
> behavior, Object& executeResult)
> at System.Data.OleDb.OleDbCommand.ExecuteReaderInternal(CommandBehavior
> behavior, String method)
> at System.Data.OleDb.OleDbCommand.ExecuteNonQuery()
> at DMSI.SqlHelper.ExecuteSql(String strSql, String strCnnString) in
> c:\inetpub\wwwroot\DMSI\SqlHelper.vb:line 9
>
> When I copy/paste the SQL directly into an Access query and run it it runs
> PERFECT.
>
> Here's the SQL:
>
> INSERT INTO
>
Employees(EmployeeId,TitleId,FirstName,MiddleInitial,LastName,Address,City,S
> tate,Zip,CellPhone,Fax,EmailAddress,UserName,Password,RegionalDirectorId)
> VALUES(8,3,'c','c','c','c','c','c','c','c','c','c','c','c',6);
>
> Ideas?
>
> Thanks!
>
>



Re: SQL syntax error??? by VB

VB
Wed Aug 18 14:14:19 CDT 2004

Thanks Marina!!!

"Marina" <someone@nospam.com> wrote in message
news:%23tfEUAVhEHA.3536@TK2MSFTNGP12.phx.gbl...
> I believe 'Password' is a reserved word. You shouldn't name your column
with
> reserved word names, as this kind of thing tends to happen.
>
> If this is indeed the problem (you didn't actually post any of your code),
> try putting Password in '[' and ']' to see if that helps.
>
> "VB Programmer" <Dont*NoSpam-Please*@jEmail.com> wrote in message
> news:uzN%2317UhEHA.3076@tk2msftngp13.phx.gbl...
> > When I run an SQL statement with ADO.NET it gives me this error:
> >
> > System.Data.OleDb.OleDbException: Syntax error in INSERT INTO statement.
> > at
System.Data.OleDb.OleDbCommand.ExecuteCommandTextErrorHandling(Int32
> > hr)
> > at
> >
>
System.Data.OleDb.OleDbCommand.ExecuteCommandTextForSingleResult(tagDBPARAMS
> > dbParams, Object& executeResult)
> > at System.Data.OleDb.OleDbCommand.ExecuteCommandText(Object&
> > executeResult)
> > at System.Data.OleDb.OleDbCommand.ExecuteCommand(CommandBehavior
> > behavior, Object& executeResult)
> > at
System.Data.OleDb.OleDbCommand.ExecuteReaderInternal(CommandBehavior
> > behavior, String method)
> > at System.Data.OleDb.OleDbCommand.ExecuteNonQuery()
> > at DMSI.SqlHelper.ExecuteSql(String strSql, String strCnnString) in
> > c:\inetpub\wwwroot\DMSI\SqlHelper.vb:line 9
> >
> > When I copy/paste the SQL directly into an Access query and run it it
runs
> > PERFECT.
> >
> > Here's the SQL:
> >
> > INSERT INTO
> >
>
Employees(EmployeeId,TitleId,FirstName,MiddleInitial,LastName,Address,City,S
> >
tate,Zip,CellPhone,Fax,EmailAddress,UserName,Password,RegionalDirectorId)
> > VALUES(8,3,'c','c','c','c','c','c','c','c','c','c','c','c',6);
> >
> > Ideas?
> >
> > Thanks!
> >
> >
>
>