Posts

Showing posts from May, 2011

SAS StoredProcessService events

If you encounter the following error when using SAS's StoredProcessService events:

event invocation for COM objects requires event to be attributed with DispIdAttribute

Roll your project back from .NET 4.0 to .NET 3.5. This may only be applicable to the web services code.

Example code:

class Program
{
static void Main(string[] args)
{

Workspace ws = new Workspace();
SAS.LanguageService ls = ws.LanguageService;
ls.StepError += new CILanguageEvents_StepErrorEventHandler(ls_StepError); <---- ERROR OCCURS HERE
ls.Submit("data test; abort; run;");
}
static void ls_StepError()
{
Console.WriteLine("Bingo!");
Console.ReadLine();
}
}

Flush with excitement...errr, logs

Image
Well, it is Friday night, I am back from the doctor with antibiotics due to a possible spider bite (love those little guys), and I decide to track down some performance issues with the SAS StoredProcessService (or Microsoft's Cassini). Somewhere, someone is responsible. Set up my little test bed to see it all work:


SAS.Workspace ws = new Workspace();
LanguageService ls = ws.LanguageService;
StoredProcessService sp = ls.StoredProcessService;
sp.Repository = @"file:" + @"x:\temp";
sp.Execute("test.sas", string.Empty);


All is well and good. Life is happy, kids are playing, sunshine is everywhere.

Wait! We need to see if the code ran. let's check the log:


string log = ls.FlushLog(1000);

AHHHH!!!! It never comes back. Where is my string!?!?

Turns out that if the FlushLog int amount EXCEEDS the total number of chars in the log, you go to a happy place called infinity. Less than the total chars and all is well.

I decided to test this a few times and was able to get…