BlueCoder (6) [Avatar] Offline
#1
Hi

I am trying to call a store procedure that is listed in the left pane of LINQPad. In the right pane I have

string PetN="";
GetPetName(8, PetN);

Console.WriteLine(PetN);

where 'GetPetName' is the stored procedure. However the, since the PetN variable is not defined as an 'out' or 'ref' parm, nothing gets returned? This work in code using LINQ to SQL, but not in LINQPad.

Anyone know of a workaround?
Michael
jwooley (123) [Avatar] Offline
#2
Re: How to call a stored procedure
I suspect this is an issue with LINQPad. It doesn't use the same mapping routines as Visual Studio does. I've noticed this with the concurrency checking and suspect you may have run into the same issue. I recommend you send feedback to the LINQPad authors at http://www.linqpad.net/feedback.aspx.

Jim
BlueCoder (6) [Avatar] Offline
#3
Re: How to call a stored procedure
Thanks Jim... I will do that...
BlueCoder (6) [Avatar] Offline
#4
Re: How to call a stored procedure
Jim -

Actually - while I am thinking about it, would you know if there is an alternate way to call a MSSQL store procedure using LINQ. Or does the LINQ to SQL data context need to be setup in all cases?

Michael
jwooley (123) [Avatar] Offline
#5
Re: How to call a stored procedure
We discuss consuming stored procs in chapter 8.

Jim
BlueCoder (6) [Avatar] Offline
#6
Re: How to call a stored procedure
Thanks Jim

I read the chapter - the included LIA.MDF does not include the store procedure 'GetBook', is there a more updated database I can download?

Michael
jwooley (123) [Avatar] Offline
#7
Re: How to call a stored procedure
Chapter's 6-8 use a different version of the lia database. You should have a lia6-8.mdf file in your samples. It should be included with the LINQPad downloadable samples if you use those. This was to handle some of the advanced features that aren't included elsewhere in the book, like consumine stored procedures, timestamps, and inheritance models.

Jim
BlueCoder (6) [Avatar] Offline
#8
Re: How to call a stored procedure
I downloaded the full examples directly from and into LINQPad. However I can not locate WHERE it put the samples or the databases. If it would let me download a ZIP file or something like that, then I would know its location.

The search box in windows explorer is no help, I even looked where the LINQPad.exe is, still no luck.
BlueCoder (6) [Avatar] Offline
#9
Re: How to call a stored procedure
Got it. I download the samples from the book, and the bonus chapters, and in that download was a directory (6-smilie that had another LIA database in it, and that one had all the Stored Procedures.

Thanks.