Solved

Microsoft OLE DB Provider for SQL Server error '80040e14' Incorrect syntax near the keyword 'User'

Posted on 2015-02-02
4
931 Views
Last Modified: 2015-03-25
Hi experts
i am trying to add a new record in the table but i am getting a strange error
Microsoft OLE DB Provider for SQL Server error '80040e14' Incorrect syntax near the keyword 'User'.

my code is

set chqOrs = Server.CreateObject("Adodb.Recordset")
    sql="Select * from personal"
    chqOrs.Open sql,oConn,1,3
    chqOrs.AddNew
    chqOrs("cprno")="00000005"
    chqOrs.Update

Open in new window


i dont know from where 'User' come ?
please help
0
Comment
Question by:AZZA-KHAMEES
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
4 Comments
 
LVL 66

Accepted Solution

by:
Jim Horn earned 500 total points
ID: 40585643
Since I don't see a schema for the table, possibilities are...
There's a trigger on the table that threw a syntax error based on User (likely)
personal is a view and not a table, and either not updatable or requiring User to be populated.

As an aside, you're wasting processing time loading a SELECT * query into a recordset object if all you're doing is inserting a row.
0
 
LVL 44

Expert Comment

by:Rainer Jeschor
ID: 40585644
Hi,
I guess that you have a column named User which is a reserved SQL word.
As you first run a Select * you will get the column names without square brackets which is normally the eay to escape reserved column names.
Please try to replace the SELECT * with
SELECT [Col1], [User],[Col3], ...
If you just need to add the record and just set one field value, this one column should be enough.
HTH
Rainer
0
 
LVL 8

Expert Comment

by:Naitik Gamit
ID: 40585653
The problem is with sql statements,try another way for exp:
use full path of your table

like,
sql="Select * from dbo.personal"
or
sql="Select * from [user].[dbo].personal" as per your database
0
 

Expert Comment

by:DMontgomeryNGC
ID: 40687138
Sorry for the delays.  Hopefully the network group will get to it today.  I am also meeting with Mgrs. today to discuss the issue.  I will let you know the outcome.
0

Featured Post

SharePoint Admin?

Enable Your Employees To Focus On The Core With Intuitive Onscreen Guidance That is With You At The Moment of Need.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article is the result of a quest to better understand Task Scheduler 2.0 and all the newer objects available in vbscript in this version over  the limited options we had scripting in Task Scheduler 1.0.  As I started my journey of knowledge I f…
Ever needed a SQL 2008 Database replicated/mirrored/log shipped on another server but you can't take the downtime inflicted by initial snapshot or disconnect while T-logs are restored or mirror applied? You can use SQL Server Initialize from Backup…
There are cases when e.g. an IT administrator wants to have full access and view into selected mailboxes on Exchange server, directly from his own email account in Outlook or Outlook Web Access. This proves useful when for example administrator want…
NetCrunch network monitor is a highly extensive platform for network monitoring and alert generation. In this video you'll see a live demo of NetCrunch with most notable features explained in a walk-through manner. You'll also get to know the philos…

696 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question