?
Solved

Error message executing a sql statement in an ASP page

Posted on 2007-03-25
11
Medium Priority
?
215 Views
Last Modified: 2010-03-20
I am receiving the following error on my asp page.

Microsoft OLE DB Provider for SQL Server error '80040e14'

Incorrect syntax near ','.

/doUpload.asp, line 102

On line 102, it is trying to execute the following sql statement:

INSERT INTO FacilitySource VALUES ('3/4/2007 15:00','RIT-00107','RIT AID CORPORATION','107','','FS',3,4396,'',4396,'Preventive Maintenance','PARKINGLOTSWEEPINGMAINTPM','PARKING LOT SWEEPING PM','RIT-00107 - PARKING LOT SWEEPING PM - 1X/WK','REISINGER, JENNIFER','PS','PM-10009','INPRG','In Progress (INPRG)','43',,8490,'GENESIS','GENESIS','0','NO','','NO','43','43','1/18/2007','NO','','654 COLVIN AVENUE','KENMORE','NY',14217-2825,'716-447-9128','No','No','','','','');

Any help on fixing this problem is greatly appreciated.

Thanks
0
Comment
Question by:sigkappu
[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
  • 5
  • 3
  • 2
  • +1
11 Comments
 
LVL 53

Expert Comment

by:Ryan Chong
ID: 18788228
>>'43',,8490,

some value is missing here, try check your scripting to rectify this...
0
 

Assisted Solution

by:Gadik
Gadik earned 80 total points
ID: 18788240
The following value is not correct - it is not a number, so it should be in single quotation marks:

14217-2825
0
 

Author Comment

by:sigkappu
ID: 18788280
'43',,8490, Is just a blank field on creation it gets updated at a later date to contain a value
I changed 14217-2825  to 14217 and I still get the same error.

Any other of ideas of what it might be?  I'm at  a loss.
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 

Expert Comment

by:Gadik
ID: 18788293
Is the first field of your table defined as character or date/time? Probably the date should be formatted...
0
 
LVL 53

Expert Comment

by:Ryan Chong
ID: 18788295
try change '43',,8490 to '43','',8490 and change 14217-2825 to '14217-2825' ?

like:

INSERT INTO FacilitySource VALUES ('3/4/2007 15:00','RIT-00107','RIT AID CORPORATION','107','','FS',3,4396,'',4396,'Preventive Maintenance','PARKINGLOTSWEEPINGMAINTPM','PARKING LOT SWEEPING PM','RIT-00107 - PARKING LOT SWEEPING PM - 1X/WK','REISINGER, JENNIFER','PS','PM-10009','INPRG','In Progress (INPRG)','43','',8490,'GENESIS','GENESIS','0','NO','','NO','43','43','1/18/2007','NO','','654 COLVIN AVENUE','KENMORE','NY','14217-2825','716-447-9128','No','No','','','','');
0
 

Author Comment

by:sigkappu
ID: 18788313
The first field is defined as date/time.  What formatting do I need to do to it?
0
 
LVL 53

Accepted Solution

by:
Ryan Chong earned 1920 total points
ID: 18788338
Your first error of:

Incorrect syntax near ','.

is definitely that you got a missing value in your SQL statement.


If your first field is a date/time data type, you can try use date format of mm/dd/yyyy, or other formats like: yyyy/mm/dd or dd mmm yyyy, etc
0
 

Author Comment

by:sigkappu
ID: 18788425
For the field I want to be empty when it inserts, it is a numeric field.  What can I put into the SQL statement to put an empty field in?  If it were a text field I would put '', but I don't know what to put for a numberic field.
0
 
LVL 53

Expert Comment

by:Ryan Chong
ID: 18788464
>>What can I put into the SQL statement to put an empty field in?  If it were a text field I would put '', but I don't know what to put for a numberic field.

try put a 0 (zero) or if it allows NULL, you can try put NULL on that field.

or else, explicitly describe what fields you want to insert with values in your Insert SQL statement, like:

Insert into yourTable (field1, field2, fieldN ) values ('value1' , 12345, '3/25/2007');
0
 
LVL 53

Assisted Solution

by:Ryan Chong
Ryan Chong earned 1920 total points
ID: 18788482
in your case:

INSERT INTO FacilitySource (field1, field2, fieldN... ) VALUES ('3/4/2007 15:00','RIT-00107','Other Fields value...' );

get the idea?
0
 
LVL 2

Expert Comment

by:bandolex2
ID: 18791099
provide a 0 for numeric fields that you want empty.
band.
0

Featured Post

Percona Live Europe 2017 | Sep 25 - 27, 2017

The Percona Live Open Source Database Conference Europe 2017 is the premier event for the diverse and active European open source database community, as well as businesses that develop and use open source database software.

Question has a verified solution.

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

I have helped a lot of people on EE with their coding sources and have enjoyed near about every minute of it. Sometimes it can get a little tedious but it is always a challenge and the one thing that I always say is:   The Exchange of informatio…
Occasionally there is a need to clean table columns, especially if you have inherited legacy data. There are obviously many ways to accomplish that, including elaborate UPDATE queries with anywhere from one to numerous REPLACE functions (even within…
Michael from AdRem Software outlines event notifications and Automatic Corrective Actions in network monitoring. Automatic Corrective Actions are scripts, which can automatically run upon discovery of a certain undesirable condition in your network.…
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …

766 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