www.webdeveloper.com
Results 1 to 4 of 4

Thread: Help!!! Error!!!

Hybrid View

  1. #1
    Join Date
    Feb 2003
    Location
    Sault Ste Marie, On, Canada
    Posts
    168

    Angry RECORD DELETING ERROR??

    I AM TRYING TO DELETE A RECORDSET BASED ON A USER'S ID.
    WHY IS IT SAYING INVALID COLUMN NAME ALEX. ALEX IS THE USER'S ID. THE COLUMN NAME IS Hunt_Id ???????

    THIS IS THE ERROR

    Error Type:
    Microsoft OLE DB Provider for ODBC Drivers (0x80040E14)
    [Microsoft][ODBC SQL Server Driver][SQL Server]Invalid column name 'Alex'.
    /hunting/wwwroot/View_Members.asp, line 80

    THIS IS THE CODE

    Dim Temp

    strDel_Hunt_Id = request.form("Del_Hunt_Id")

    Temp=request.form("Deletebutton")
    If Temp <> "" then

    'strquerystring1 = " Select * FROM Hunt_Registration WHERE Hunt_Registration.Hunt_Id = " & strDel_Hunt_Id & " "
    'set recordsetDB = dbconn.execute(strquerystring1)
    THE ERROR IS UNDER HERE
    strquerystring1 = " DELETE FROM Hunt_Registration WHERE Hunt_Registration.Hunt_Id = " & strDel_Hunt_Id & " "
    set recordsetDB = dbconn.execute(strquerystring1)

    end if
    %>
    <p><a href="MainPics.htm">BACK TO MAIN MENU</a></p>
    Last edited by Calmaris; 02-18-2003 at 01:25 PM.

  2. #2
    Join Date
    Jan 2003
    Location
    Dundee, Scotland
    Posts
    1,367
    hi,
    i think your error is caused because you are not telling it what fields to delete. The SQL should be this:
    Code:
    strquerystring1 = " DELETE * FROM Hunt_Registration WHERE Hunt_Registration.Hunt_Id = " & strDel_Hunt_Id & " " 
    set recordsetDB = dbconn.execute(strquerystring1)
    But instead of this complete sql just add this line instead:

    Code:
    strquerystring1 = " Select * FROM Hunt_Registration WHERE Hunt_Registration.Hunt_Id = " & strDel_Hunt_Id & " " 
    set recordsetDB = dbconn.execute(strquerystring1) 
    recordsetDB.delete
    hope this helps
    ----------------------------------

  3. #3
    Join Date
    Feb 2003
    Location
    Sault Ste Marie, On, Canada
    Posts
    168
    HOW CAN THIS BE??????
    I'M STILL GETTING THIS ERROR AHHH, I'M PULLING MY HAIR OUT IN CLUMPS!!!!

    Error Type:
    Microsoft OLE DB Provider for ODBC Drivers (0x80040E14)
    [Microsoft][ODBC SQL Server Driver][SQL Server]Invalid column name 'Alex'.
    /hunting/wwwroot/Del_Admin.asp, line 14



    THIS IS THE NEW CODE FOR MY PAGE I DECIDED TO JUST PASS THE HUNT_ID TO ANOTHER PAGE TO DO THE DELETE

    <% @Language = VBScript %>
    <% Option Explicit %>
    <%

    Dim dbConn, dbQuery, recordsetDB, strQueryString1
    Dim strDel_Hunt_Id,temp

    Set dbConn = Server.CreateObject("ADODB.Connection")
    Call dbConn.Open ("Appdb1","Anyone","Anyone")

    strDel_Hunt_Id = request.form("Del_Hunt_Id")

    strquerystring1 = " Select * FROM Hunt_Registration WHERE Hunt_Registration.Hunt_Id = "& strDel_Hunt_Id & " "
    set recordsetDB = dbconn.execute(strquerystring1)
    recordsetDB.delete

    response.redirect("View_Members.asp")

    %>

  4. #4
    Join Date
    Feb 2003
    Location
    Sault Ste Marie, On, Canada
    Posts
    168
    K I FIGURED IT OUT I NEEDED SINGLE QUOTES AROUND THE TEMP VARIABLE. THX ANYWAY RIBBY

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles