C# tutorial example

Hi, thanks to timv for the help on my previous posts, everything now works there :)

I am trying to make my C# code invoke various scraping sessions and have implemented the skeleton code given from this site. My program seems to be upset by the line

DataSet odds = (DataSet)remoteScrapingSession.GetVariable("football extractor");

where football extractor is the name of the extractor pattern I'm using on this particular scrapable file. The error message I'm getting is
"Unable to cast object of type System.String to type 'Screenscraper.DataSet'"

If I omit this part of the code everything works fine, in that I can invoke scraping sessions and allow their scripts to write things to file and what not. But I can't seem to make my code retrieve the DataSet from a scraping session so that I can write out to console with it, or read in directly into my variables without need for an intermediate file.

Any help much appreciated,
Cheers

Thanks again, everything

Thanks again, everything working perfectly now, I was just being silly and had forgot to check sava dataset...Many thanks

So, you say that "football

So, you say that "football extractor" is the name of the extractor pattern... are you saving its dataset as a variable? Otherwise this would not work :)

The root of the problem seems to be that when you're getting the variable from the scrape, it's a String instead of a DataSet... Seems to me that you're saving by accident a String in that variable instead of the desired DataSet. I can't think of any other causes. The line of code itself isn't an uncommon thing to do.

I would comment that line out again, and just print out whatever you're getting from the variable, without trying to cast it into a DataSet. I would think that that would be the best way to figure out what String is being written over top of your DataSet by accident. It could be something as simply as accidentally storing an array position over the variable, instead of saving a variable named after the contents of an array position. Semantic errors like that snag me from time to time.