Command Text and Object Problem

Results 1 to 2 of 2

Thread: Command Text and Object Problem

  1. #1
    Join Date
    Dec 1969

    Default Command Text and Object Problem

    Hi,<BR>I&#039;m trying to delete an entry from an Access DB via an html form and ASP. And I get an error "Command text was not set for Command Object" Error 80040e0c. And it says the error is on the last line of this code where I try and run the delete SQL query.<BR><BR> Dim delConn, delRS, sql_delete<BR> Set delConn = Server.CreateObject("ADODB.Connection") <BR> Set delRS = Server.CreateObject("ADODB.Recordset")<BR> delConn.Open "Flight2a"<BR><BR> delRS.Open "Flights", "DSN=Flight2a"<BR> Set Session ("Flight2_delConn") = delConn<BR> <BR> RouteStart1 = Request.Form("RouteStart5")<BR> RouteEnd1 = Request.Form("RouteEnd5")<BR> <BR>Session("RouteStart1") = Request.Form("Routestart5")<BR>RouteStart1 = Session ("RouteStart5")<BR>Session("RouteEnd1") = Request.Form("RouteEnd5")<BR>RouteEnd1 = Session ("RouteEnd5")<BR><BR> sql_checkflight = "DELETE * FROM Flights WHERE RouteStart = &#039;" + RouteStart1 + "&#039; AND RouteEnd = &#039;" + RouteEnd1 + "&#039;"<BR> Set delRS = delConn.Execute(sql_delete)<BR><BR>

  2. #2
    Join Date
    Dec 1969

    Default RE: Command Text and Object Problem

    The line:<BR>Set delRS = delConn.Execute(sql_delete)<BR><BR>Is using the sql_delete variable. It looks as though the SQL string is being built into the sql_checkflight variable.<BR><BR>Also, a DELETE statement doesn&#039;t return a recordset, so you don&#039;t need to do the Set delRS = delConn.Execute. You can just do:<BR>delConn.Execute sql_checkflight<BR><BR>-Doug

Posting Permissions

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