Error with insert into statement

B

Ben

Im trying to insert some information into a database, but every time that I
try, I get this error. Any ideas?

----Error----
0x80040E07, activity_log.asp, line 967

----Code-----
strSQL= "INSERT INTO tblUsers (rufitPoints, totalPoints, intLevel) VALUES ( '"
& intRufitPoints & "' , '" & intTotalPoints & "' , '" & rufitLevel & "')"
-= 967=- Set rsPointsUpdate = adoCon.Execute(strSQL)

----Table----
-------------------------------------
rufitPoints | totalPoints | intLevel |
-------------------------------------
All of the Field Names are of datatype number.

Thanks

Ben
 
R

Ray at

If all the fields are numeric, do not delimit the values with '.

Also, when posting an error, post the description too. Most people don't
have the codes memorized.

Also, when doing an INSERT, don't do a SET RS =. You don't need anything
returned, do you? Instead, do:

adoCon.Execute strSQL,,129

Ray at work
 
B

Bob Barrows [MVP]

Ben said:
Im trying to insert some information into a database, but every time
that I try, I get this error. Any ideas?

----Error----
0x80040E07, activity_log.asp, line 967

----Code-----
strSQL= "INSERT INTO tblUsers (rufitPoints, totalPoints, intLevel)
VALUES ( '" & intRufitPoints & "' , '" & intTotalPoints & "' , '" &
rufitLevel & "')" -= 967=- Set rsPointsUpdate = adoCon.Execute(strSQL)

----Table----
-------------------------------------
rufitPoints | totalPoints | intLevel |
-------------------------------------
All of the Field Names are of datatype number.

Thanks

Ben

The first thing you should ALWAYS do when debugging is:
Response.Write strSQL

Look at the statement written to the browser window. Any obvious problems?
If not, copy and paste it from the browser window into the SQL View window
of the Access Query Builder and try and run it. If it is constructed
correctly, it should run witrhout modification. If this still fails to
reveal the problem, post the result of the response.write here.

Bob Barrows
 
B

Ben

Thanks for the information, I finally got it to work.

Bob:
I printed out the strSQL statement and realized that I was
assigning my values incorrectly, after fixing that it
worked perfectly.

Ray:
What does the 129 in this line mean?
adoCon.Execute strSQL,,129




-=Ben
-=To email me take out the joke.
 
B

Bob Barrows [MVP]

Ben said:
Thanks for the information, I finally got it to work.

Bob:
I printed out the strSQL statement and realized that I was
assigning my values incorrectly, after fixing that it
worked perfectly.

Ray:
What does the 129 in this line mean?

Since I'm here I'll answer for Ray:

129 is the combination of two values: 1 and 128

1 = adCmdText. It tells ADO that you want it to execute a sql statment
contained in a string. Always supply this argument. Don't make ADO guess
what the command type is:
a) It wastes programming cycles
b) It may (rarely) guess wrong

128 = adExecuteNoRecords This tells ADO that you do not expect to get any
records back from the query you are executing, so it will not waste
resources and processing cycles creating a recordset behind the scenes to
receive a non-existent resultset.

If you are not using Visual Studio, you can find the ADO documentation at
msdn:
http://msdn.microsoft.com/library/en-us/ado270/htm/dasdkadooverview.asp

In particular, the Execute command is explained here:
http://msdn.microsoft.com/library/en-us/ado270/htm/mdmthcnnexecute.asp

HTH,
Bob Barrows
 

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

Forum statistics

Threads
473,767
Messages
2,569,572
Members
45,046
Latest member
Gavizuho

Latest Threads

Top