Assuming that your intent is to return a result set and not just the integer return code from the stored procedure my guess is that LINQ was not able to properly determine the type of the result set Check the properties of the stored procedure in your LINQ to SQL classes module. If LINQ was able to determine the result set type when it was added to your module it should say "(Auto-generated Type)". If not, it will probably say "Integer This can happen if the proc fails for some reason when LINQ attempts to get the result set type.It can also happen when the result set of your proc is derived from a temporary table.
If this is true the case then try adding SET FMTONLY OFF to the top of your proc. Then refresh the proc in Server Explorer, then drop and re-add the proc to your LINQ to SQL classes to refresh it.
Assuming that your intent is to return a result set and not just the integer return code from the stored procedure my guess is that LINQ was not able to properly determine the type of the result set. Check the properties of the stored procedure in your LINQ to SQL classes module. If LINQ was able to determine the result set type when it was added to your module it should say "(Auto-generated Type)".
If not, it will probably say "Integer". This can happen if the proc fails for some reason when LINQ attempts to get the result set type. It can also happen when the result set of your proc is derived from a temporary table.
If this is true the case then try adding SET FMTONLY OFF to the top of your proc. Then refresh the proc in Server Explorer, then drop and re-add the proc to your LINQ to SQL classes to refresh it.
The stored procedure is poorly written and yet I cannot change it. The properties of the sp in my dbml module identifies the return type as "None", but when I use it in my code, it thinks it's an int. – JackMarsal Jul 7 '09 at 21:44 And if you execute the stored procedure with the given parameters in your query tool of choice, e.g. SQL Server Management Studio for MS SQL Server, what result do you get?
Do you get a scalar value, like and integer, or a result set? – Bob Mc Jul 8 '09 at 13:54 I get both, a scalar and a result set. – JackMarsal Jul 8 '09 at 16:55 Make sure you execute the proc as the same user that you use to connection your application to the database.
Also, can you see the text of the stored proc using SQL Server Management Studio or "sp_helptext"? If so, is the result returned from a temporary table? – Bob Mc Jul 8 '09 at 17:45.
If so remove the integer return and remap the stored procedure or map the return type of the SP in the context to the appropriate object type. Otherwise the return will be the int.
The intent is to get the result set. Oh, and btw, I can't modify the stored procedure. – JackMarsal Jul 7 '09 at 21:41.
Lookup = 0; app. SpLookupFrom400(numberType, number, ref lookup).
The answers so far miss the fact that SQL Server stored procedures can produce any number of result sets and also return a value. Mostly, of course, they don't do both, so this might be what's tripping up Linq to SQL. Whenever "magic glue code" (such as Linq to SQL) stops working, I always look for ways to make its work easier.So I would try writing another stored procedure that calls the troublesome one but discards the scalar value.
This walkthrough provides a basic end-to-end LINQ to SQL scenario for accessing data by executing stored procedures only. This approach is often used by database administrators to limit how the datastore is accessed. For purposes of this walkthrough, you will use two methods that have been mapped to stored procedures in the Northwind sample database: CustOrdersDetail and CustOrderHist.
The mapping occurs when you run the SqlMetal command-line tool to generate a C# file. For more information, see the Prerequisites section later in this walkthrough.
I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.