Script not getting hit...?

Results 1 to 2 of 2

Thread: Script not getting hit...?

  1. #1
    Join Date
    Dec 1969

    Default Script not getting hit...?

    Hey Guys,<BR> I have the following code<BR><BR>Dim oConn<BR><BR>&#039; create and open the connection to the database<BR>Set oConn = Server.CreateObject("ADODB.Connection")<BR>&#039;< BR>&#039; this version uses a DSN-less connection!<BR>oConn.Open "DRIVER=Microsoft Access Driver (*.mdb);" _<BR> & "DBQ=" & Server.MapPath("../caststone.mdb")<BR><BR>If Request.Form("btnDelete") = "Delete Category" Then<BR><BR>&#039; we always need the list of categories, so get it now<BR>Set oConn = oConn.Execute ("Delete * FROM tItem WHERE tItem.ItemID=" & Request.Form("cat") & "")<BR><BR>ElseIf Request.Form("btnDelete") = "Delete Style" Then<BR><BR>Response.Write "Deleted Item"<BR><BR>Set oConn = oConn.Execute("Delete * FROM tStyle WHERE ItemID=" & Request.Form("cat") & "")<BR><BR>Response.Write "Deleted Style"<BR><BR>ElseIf Request.Form("btnDelete") = "Delete Type" Then<BR><BR>Set oConn = oConn.Execute("Delete * " _<BR> & " FROM tType,tStyleTypeImage WHERE Ttype.TypeID=" & Request.Form("ctlTypeID") & "")<BR><BR>Response.Write "Deleted Type"<BR><BR>End If<BR><BR><BR>And I have this button on my page, three times, with three different values. <BR><BR><BR>&#060;input class=&#039;btn&#039; type=button name=btnDelete Value="Delete Category" onClick="document.frmCat.submit();"&#062;<BR><BR>< BR>But when I click the button and the form submits, the delete is not taking effect. Any ideas why? Thanks<BR><BR><BR><BR>Harry C<BR><BR>

  2. #2
    Join Date
    Dec 1969

    Default RE: Script not getting hit...?

    Set oConn = oConn.Execute("Delete * FROM tStyle WHERE ItemID=" & Request.Form("cat") & "")<BR><BR>should be :<BR>oConn.Execute("Delete * FROM tStyle WHERE ItemID=" & Request.Form("cat") & "")<BR><BR>and are you sure that request.form("cat") is returning a value? Is the code actually reaching inside the if statement?<BR>

Posting Permissions

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