What's wrong with this delete operation

Results 1 to 3 of 3

Thread: What's wrong with this delete operation

  1. #1
    Join Date
    Dec 1969

    Default What's wrong with this delete operation

    Ok, I have a list of questions that are generated. I have made a delete button that works through the querystring. Here is my code that is suppose to perform the delete.<BR><BR>It is not even nothing is happening here:<BR><BR>&#060;% <BR> If Request.QueryString("Action")="Delete" Then<BR> <BR> <BR> <BR> Dim Conn<BR> Dim SQL<BR> <BR> &#039;Building the SQL String<BR> SQL = "Delete * from ITO2..ITO_QUIZ_QUESTIONS" _<BR> & " WHERE QuestionNumber = " & Request.QueryString("QN") _<BR> & " AND QuizID =&#039;" & Request.QueryString("QID") & "&#039; "<BR> Response.write SQL <BR> <BR> &#039;Create and open the database object<BR> Set Conn = Server.CreateObject("ADODB.Connection")<BR> Conn.Open "DSN=ITO2;UID=sa;PWD=;"<BR> <BR> <BR> &#039;Create the Command Object<BR> Set ObjCmd = Server.CreateObject("ADODB.Command")<BR> <BR> <BR> &#039;Set the command object properties<BR> Set ObjCmd.ActiveConnection = Conn<BR> ObjCmd.CommandText = SQL<BR> ObjCmd.CommandType = adCmdText<BR> <BR> &#039;Execute the Command<BR> ObjCmd.Execute<BR> <BR> <BR> &#039;Displaying the Delete String<BR> <BR> <BR> <BR> &#039;Close and dereference the Connection and Command Objects<BR> Set ObjCmd = Nothing<BR> ObjCmd.close<BR> Set Conn = Nothing<BR> <BR> End if<BR> <BR> Response.redirect "Confirmation.asp"<BR>%&#062;

  2. #2
    Join Date
    Dec 1969

    Default Two possible reasons:

    This does not seem to make sense:<BR><BR>"It is not even nothing is happening here:"<BR><BR>Check that code, and try your script again.<BR><BR><BR>Or, take out the * from the delete statement.<BR>

  3. #3
    Join Date
    Dec 1969

    Default RE: Two possible reasons:

    I think you might also want to close the object before setting it to Nothing. Maybe it will make no difference, but I&#039;m not sure what your problem is? Are you getting errors or is it just not deleting the record?

Posting Permissions

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