Re: ASP and Access SQL Problem

Tech-Archive recommends: Fix windows errors by optimizing your registry

From: Stephanie Stowe (NoSpam_at_IWishICould.com)
Date: 10/08/04


Date: Fri, 8 Oct 2004 08:43:00 -0400

Do this. I am assuming that objConn is opened before this code is hit.

strSQL = whatever ...
objConn.Execute strSQL

And do not use the recordset at all. There is no recordset for an INSERT
statement to return anyway.

S
"Micromanaged" <novirus@nospam.org> wrote in message
news:eGcMxeLrEHA.644@tk2msftngp13.phx.gbl...
> I am attempting to insert data into an Access 2k database with the
> following in an asp page:
>
> strSQL="INSERT INTO EmpIncentive(Purple, " & _
> "Red, Orange, Yellow, Green, Blue, Clndr) " & _
> "VALUES('" & rEmployee & "', '" & rdffclt & "', '" & rrspnsetm & "', '"
> & rcrrctd & "', '" & rcstmrsrvc & "', '" & rcmmnts & "', '" & rclndr &
> "')"
>
>
> Dim objRS
> Set objRS=Server.CreateObject("ADODB.Recordset")
> objRS.Open strSQL, objConn
> objRS.Close
> Set objRS=Nothing
> objConn.Close
> Set objConn=Nothing
>
> When the user hits submit, the data from the form page is posted to a
> "Success" page where the above SQL statement is executed. The data is
> successfully inserted; however, the html/asp page that is the "Success"
> page is supposed to summarize the data for the user gives me the
> following error:
>
> Error Type:
> ADODB.Recordset (0x800A0E78)
> Operation is not allowed when the object is closed.
> /incentive/incentive.asp, line 52
>
> I commented out the objRS.Close line and things work (the line with the
> error above. Is this proper?
>
>
> *** Sent via Developersdex http://www.developersdex.com ***
> Don't just participate in USENET...get rewarded for it!



Relevant Pages

  • Re: "Transaction deadlocked" problem
    ... > as the deadlock victim. ... > I tried the following syntax on my recordset Opens: ... > objRec.Open strSQL, objConn, adOpenForwardOnly, adLockReadOnly ...
    (microsoft.public.scripting.vbscript)
  • Re: No Index Violation when adding data in Acccess from Excel
    ... dbsAccessData.Execute (strSQL) ... ' Initialize string to database path. ... Dim rstEmployees As Recordset ... ' Open Recordset using temporary QueryDef object and ...
    (microsoft.public.excel.programming)
  • Re: ADODB.Recordset (0x800A0E78)
    ... Start your debugging efforts by adding: ... Response.Write strSQL ... Do not use a recordset to execute a query that does not return records. ...
    (microsoft.public.inetserver.asp.db)
  • Re: SQLs
    ... the database ... 'Set an active connection to the Connection object using ... 'Create an ADO recordset object ... 'Initialise the strSQL variable with an SQL statement to ...
    (microsoft.public.frontpage.programming)
  • Re: ADO Find fails (yet not loaded recordset)
    ... Private Sub Form_Open ... strSQL = " SELECT SOMETHING" ... If globalIDgoto 0 Then ... because the recordset isn't still ...
    (microsoft.public.access.adp.sqlserver)