473,387 Members | 1,536 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

syntax error in sql statement

232 100+
Expand|Select|Wrap|Line Numbers
  1.  db.Execute "INSERT INTO TAXDET (ECODE, totsaving,OTHERSAV) VALUES('" & ecode & "'," & totsaving & "," & OTHERSAV & ")"
gives error
syntax error in sql statement
and in debug mode it shows totsaving =null and
OTHERSAV =null
kindly help me to correct error
thanx in adv
Jan 24 '13 #1

✓ answered by zmbd

On my way out the door to work, thus, only a very quick look and answer:

You really haven't provided enough of the code to help.
What I do is build the string first so that you can troubleshoot the resolved string. Something along the lines of:

Expand|Select|Wrap|Line Numbers
  1. strSQL = "INSERT INTO TAXDET (ECODE, totsaving,OTHERSAV) VALUES('" & ecode & "'," & totsaving & "," & OTHERSAV & ")"
  2. Debug.Print strSQL
  3. db.Execute  strSQL
Now you can look in the debug window and see what your string issue is...

2 1190
zmbd
5,501 Expert Mod 4TB
On my way out the door to work, thus, only a very quick look and answer:

You really haven't provided enough of the code to help.
What I do is build the string first so that you can troubleshoot the resolved string. Something along the lines of:

Expand|Select|Wrap|Line Numbers
  1. strSQL = "INSERT INTO TAXDET (ECODE, totsaving,OTHERSAV) VALUES('" & ecode & "'," & totsaving & "," & OTHERSAV & ")"
  2. Debug.Print strSQL
  3. db.Execute  strSQL
Now you can look in the debug window and see what your string issue is...
Jan 24 '13 #2
NeoPa
32,556 Expert Mod 16PB
Your string issue is that you have no values for either of these fields in your SQL command. If you want Null then you have to use the text "Null", and if you want zero then "0". Leaving it empty, as you have done, will throw an error (such as you've seen).
Jan 24 '13 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: Robert Mark Bram | last post by:
Hi All! I have the following two methods in an asp/jscript page - my problem is that without the update statement there is no error, but with the update statement I get the following error: ...
29
by: shank | last post by:
1) I'm getting this error: Syntax error (missing operator) in query expression on the below statement. Can I get some advice. 2) I searched ASPFAQ and came up blank. Where can find the "rules"...
7
by: kosta | last post by:
hello! one of my forms communicates with a database, and is supposed to add a row to a table using an Insert statement... however, I get a 'oledb - syntax error' exception... I have double...
3
by: Nathan Sokalski | last post by:
When trying to submit data to an Access database using ASP.NET I recieve the following error: System.Data.OleDb.OleDbCommand.ExecuteCommandTextErrorHandling(Int32 hr) +41...
1
by: amitbadgi | last post by:
HI i am getting the foll error while conv an asp application to asp.net Exception Details: System.Runtime.InteropServices.COMException: Syntax error in UPDATE statement. Source Error: Line...
5
by: amitbadgi | last post by:
Hi guys, I am getting the following error in teh insert statement , I am converting this asp application to asp.net, here is teh error, Exception Details:...
2
by: Nate | last post by:
I am trying to use the following IF statement, and whenever I use a single or double quote, I receive a syntax error. When using no quotes, the syntax is accepted, but the statement does not...
0
by: Alexis Boutillier | last post by:
Timothy Grant a écrit : As you can see in my last response, this problem is not linked to the type of error, If I "raise" a SystemError instead of creating a SyntaxError I still can't access...
1
by: vasanth chandrasekaran | last post by:
The error is :Syntax error in INSERT INTO statement. This is my code: try { DataSet ds1; OleDbConnection ConnSql; OleDbConnection...
3
by: lingjun | last post by:
Hi, I am taking my first programing course in college... and I am completely lost on this assignment. I am not sure what is wrong with my current code. Any help will be appreciate it... thanks! ...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.