What's wrong with this?

O

Oli

Hi

What's wrong with this?

sql="insert into tblNumbers (Number) values ('" & i & "')"

I get...
Error Type:
Microsoft JET Database Engine (0x80040E14)
Syntax error in INSERT INTO statement.
/admin/numberrange.asp, line 14

Many thanks
Oli
 
T

Tony Archer

If you are inserting a number then it should not have quotes around it.
That is a bad practice that Access can get you used to.

Try:

sql="insert into tblNumbers (Number) values (" & i & ")"
 
R

Ray at

RESPONSE.WRITE SQL
RESPONSE.END

What does that show you?

Is Number a numeric column? If so, don't put the value in '.

Ray at work
 
R

Ray at

p.s. NUmber is a reserved word. You may have to use:
sql = "insert into tblNumbers ([Number]) values......"

Ray at work
 
K

Kris Eiben

Couple of thoughts:
1) If "Number" is numeric, it shouldn't need the 'single quotes' around
the value.
2) "Number" may be a reserved word, so try [square brackets] around the
field name.
3) Try response.write(sql) rather than conn.execute(sql) to see what
statement you're actually executing. This won't solve anything by
itself, but it may show you the problem (i.e. the variable "i" doesn't
hold what you think it does).
 
T

TomB

Oh yeah, is the column called Number of type Number? If so, then you don't
want those apostrophe's surrounding the value.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,013
Latest member
KatriceSwa

Latest Threads

Top