This one is a real Keeper

So, if you ever get this error while trying to work with OleDb and SAS IOM:

The object ... could not be found; make sure it was previously added to the object keeper

Make sure that you include the following lines (the lack of a Keeper is what causes this error):

ObjectFactory factory = new ObjectFactory();
ServerDef server = new ServerDef();
Workspace ws = (Workspace)factory.CreateObjectByServer("ws", true, server, "", "");
ObjectKeeper keeper = new ObjectKeeper();
keeper.AddObject(1, "SASServer", ws);


That whole ObjectKeeper is missing from a number of examples that I have seen and it is critical for everything to function. It becomes apparent when trying to get the data from an OleDb DataAdaptor.

Comments

Anonymous said…
Thank you!!! Would have taken me forever to figure this out. I'm completely unfamiliar with SAS - trying to update some old .Net code (with new 64-bit platform, new SAS version, etc.) -Walt

Popular posts from this blog

DNN Error

SAS XPT Files, IBM Floats, and C#

SAS Deployment Manager and Meadow Muffins