Solved

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

Posted on 2015-02-02
4
606 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
4 Comments
 
LVL 65

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

[Webinar] Disaster Recovery and Cloud Management

Learn from Unigma and CloudBerry industry veterans which providers are best for certain use cases and how to lower cloud costs, how to grow your Managed Services practice in IaaS clouds, and how to utilize public cloud for Disaster Recovery

Question has a verified solution.

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

Not long ago I saw a question in the VB Script forum that I thought would not take much time. You can read that question (Question ID  (http://www.experts-exchange.com/Programming/Languages/Visual_Basic/VB_Script/Q_28455246.html)28455246) Here (http…
SQL Server engine let you use a Windows account or a SQL Server account to connect to a SQL Server instance. This can be configured immediatly during the SQL Server installation or after in the Server Authentication section in the Server properties …
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, just open a new email message. In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).

867 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

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now