Error with insert into statement

Discussion in 'ASP General' started by Ben, Apr 26, 2004.

  1. Ben

    Ben Guest

    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
     
    Ben, Apr 26, 2004
    #1
    1. Advertising

  2. Ben

    Ray at Guest

    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:...
    > 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
     
    Ray at, Apr 26, 2004
    #2
    1. Advertising

  3. 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.
     
    Bob Barrows [MVP], Apr 26, 2004
    #3
  4. Ben

    Ben Guest

    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!
     
    Ben, Apr 26, 2004
    #4
  5. 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-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

    --
    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.
     
    Bob Barrows [MVP], Apr 26, 2004
    #5
  6. Ben

    Ray at Guest

    "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
     
    Ray at, Apr 26, 2004
    #6
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. compuglobalhypermeganetz0r

    adapter update problem Syntax error in INSERT INTO statement.

    compuglobalhypermeganetz0r, Dec 8, 2003, in forum: ASP .Net
    Replies:
    0
    Views:
    831
    compuglobalhypermeganetz0r
    Dec 8, 2003
  2. Saber
    Replies:
    5
    Views:
    531
    Jo Inferis
    Jul 20, 2004
  3. =?Utf-8?B?T2ZmX1JvdXRl?=

    ASP Error on INSERT INTO Statement

    =?Utf-8?B?T2ZmX1JvdXRl?=, Oct 21, 2004, in forum: ASP .Net
    Replies:
    1
    Views:
    3,077
  4. =?Utf-8?B?T2ZmX1JvdXRl?=

    ASP Error on INSERT INTO Statement

    =?Utf-8?B?T2ZmX1JvdXRl?=, Oct 21, 2004, in forum: ASP .Net
    Replies:
    0
    Views:
    313
    =?Utf-8?B?T2ZmX1JvdXRl?=
    Oct 21, 2004
  5. =?Utf-8?B?T2ZmX1JvdXRl?=

    ASP Error on INSERT INTO Statement

    =?Utf-8?B?T2ZmX1JvdXRl?=, Oct 21, 2004, in forum: ASP .Net
    Replies:
    0
    Views:
    278
    =?Utf-8?B?T2ZmX1JvdXRl?=
    Oct 21, 2004
Loading...

Share This Page