views:

305

answers:

1

Hello!

I got this, its calling a SP in my MS SQL 2008 database:

[Function(Name = "dbo.Content_GetContent")]
    [ResultType(typeof(Content_GetContentResult))]
    [ResultType(typeof(Content_GetContentImagesResult))]
    [ResultType(typeof(Content_GetContentBoxesResult))]
    [ResultType(typeof(Content_GetContentSearchWordsResult))]
    public IMultipleResults GetContent([Parameter(DbType = "INT")]int? contentID)
    {
        IExecuteResult result = this.ExecuteMethodCall(this, ((MethodInfo)(MethodInfo.GetCurrentMethod())), contentID);
        return ((IMultipleResults)(result.ReturnValue));
    }

But i got 2 problems, not every table might return a result and if the contentID supplied is incorrect (not a valid content number) then it fails and it generates the following error: "More than one result type declared for function 'GetContent' that does not return IMultipleResults."

Any ideas how to solve this?

A: 

Can you change the stored procedure so that it returns empty tables when an incorrect contentID is supplied? (instead of returning a message or whatever it does at the moment)

If your stored procedure is not guaranteed to return the same number of tables each time then you're in for a tricky time working out which ones did get returned ...

codeulike