Click to See Complete Forum and Search --> : Help!!! Error!!!


Calmaris
02-18-2003, 11:17 AM
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>

Ribeyed
02-18-2003, 02:42 PM
hi,
i think your error is caused because you are not telling it what fields to delete. The SQL should be this:

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:


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


hope this helps

Calmaris
02-18-2003, 02:58 PM
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")

%>

Calmaris
02-18-2003, 04:04 PM
K I FIGURED IT OUT I NEEDED SINGLE QUOTES AROUND THE TEMP VARIABLE. THX ANYWAY RIBBY