Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP General > Error with insert into statement

Reply
Thread Tools

Error with insert into statement

 
 
Ben
Guest
Posts: n/a
 
      04-26-2004
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
 
Reply With Quote
 
 
 
 
Ray at
Guest
Posts: n/a
 
      04-26-2004
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

"Ben" <> wrote in message
news: om...
> 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



 
Reply With Quote
 
 
 
 
Bob Barrows [MVP]
Guest
Posts: n/a
 
      04-26-2004
Ben wrote:
> 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

--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup.


 
Reply With Quote
 
Ben
Guest
Posts: n/a
 
      04-26-2004
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.

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
 
Reply With Quote
 
Bob Barrows [MVP]
Guest
Posts: n/a
 
      04-26-2004
Ben wrote:
> 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

>


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...dooverview.asp

In particular, the Execute command is explained here:
http://msdn.microsoft.com/library/en...cnnexecute.asp

HTH,
Bob Barrows

--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup.


 
Reply With Quote
 
Ray at
Guest
Posts: n/a
 
      04-26-2004

"Bob Barrows [MVP]" <> wrote in message
news:...
>
>
> Since I'm here I'll answer for Ray:


That's good. Your answer is much better than what mine would have been. :]

Ray at home


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
ASP Error on INSERT INTO Statement =?Utf-8?B?T2ZmX1JvdXRl?= ASP .Net 1 10-21-2004 11:43 PM
ASP Error on INSERT INTO Statement =?Utf-8?B?T2ZmX1JvdXRl?= ASP .Net 0 10-21-2004 09:51 PM
ASP Error on INSERT INTO Statement =?Utf-8?B?T2ZmX1JvdXRl?= ASP .Net 0 10-21-2004 09:51 PM
Syntax error in INSERT INTO statement Saber ASP .Net 5 07-20-2004 11:26 AM
adapter update problem Syntax error in INSERT INTO statement. compuglobalhypermeganetz0r ASP .Net 0 12-08-2003 05:03 AM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57