Error using ADO

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance

From: Darwood (darrenw_at_nospamme.woodfordcomputers.co.uk)
Date: 08/12/04


Date: Thu, 12 Aug 2004 17:08:47 +0100

I have created a middle tier project and am trying to pass the data up to
the presentation tier using ADO. When I try to move (If !objCustomers.EOF
MoveFirst etc) through the recordset from the top tier I get a message
saying "Runtime 3704: Operation is not allowed when the object is closed"
I am therefore trying to just create a simple ADO example without using 3
tier model. This too is giving me grief. I get the message "OLE exception
error: Exception code c0000005 OLE object may be corrupt"
My Customer on a separate machine has replicated the first problem but not
the second. Is it the ADO OLE object that is corrupt? How do I repair my ADO
objects?

I have got the VFP8 OLE DB Provider from the web installed.
I have put the code below that causes the second error.

#include "ADOVFP.H"

Set Step On
loCustomers = GetCustomers()

Function GetCustomers

 loConnection = CreateObject("ADODB.Connection")

 **************************************************
 ** This connection string must be parameterised **
 **************************************************
 lcConnectionString = "provider=vfpoledb;data source=" +
"C:\operaii\data\comp_z.dbc"
 loConnection.ConnectionString = lcConnectionString

 loConnection.Open

 lcFilter = ""

 loRS = CreateObject("ADODB.Recordset")
 With loRS
  .ActiveConnection = loConnection
  .Source = "sname"
  .CursorType = adOpenStatic
  .LockType = adLockReadOnly
  .CursorLocation = adUseClient
  .Open() && This is the line that gives exception code c0000005
  .Filter = lcFilter
 EndWith

 Return loRS

EndFunc

-- 
Regards
Darren Woodford - MCP, MCSE
Woodford Computer Systems Ltd
http://www.woodfordcomputers.co.uk
http://www.pegasus-opera-ii.co.uk


Relevant Pages

  • Re: Error using ADO
    ... sans ADO? ... passing things around from 1st tier to 3rd tier, ... what is value of loRS after the first assignment? ... Is it the ADO OLE object that is corrupt? ...
    (microsoft.public.fox.programmer.exchange)
  • convert to 3 tier ?
    ... I"m checking the option to convert my application (Delphi7/ ADO / MsSql) to ... tier. ... anyone know regarding the licence policy? ...
    (borland.public.delphi.database.ado)