LINQ to SQL, Stored Procedures and Method Panel (more like PAIN methods!)

I am new to LINQ and I have a little problem. I created a DBML file and dragged all my tables onto the design surface. Now when I try to drag and drop a stored procedure onto the method bar, Visual Studio thinks for a second and then does nothing. My method is not showing in the method bar.

Was there some kind of mistake behind the scenes? If so, how can I fix it?

0


a source to share


3 answers


It is possible that a LINQ to SQL developer will be unable to define the schema for your stored procedure, especially if you are using temporary tables. Try changing the stored procedure to just select it from the table, map it to the designer (by dragging the top of the correct table), then change the procedure back to the original code.



+1


a source


I just tried it myself. I used VS2008 SP1, dragged each table from my DB to the class pane and added. Then I drag and drop the stored procedure. It took longer to process SP and then tables, but the method showed up without issue in my method panel. Your stored procedure might not use the metadata available to successfully create a method for it.



Did I do it right?

0


a source


Jep, I had the same problem. My mistake was that the stored procedure I was trying to add to the panel had a return result with the geography type in it. This is not yet supported by the LinQ2SQL designer.

What can you do to check the returned data types (if you are using some exotic ones) add them as parameters to the stored procedure. The designer will report an error.

For example, try adding the following stored procedure to the panel, it will throw an error:

CREATE PROCEDURE test
(
    @GeographicLocation geography
)
AS
BEGIN
END;

      

0


a source







All Articles