tags:

views:

36

answers:

2

Hello

I am using subsonic, I'm reasonably new at it. Today is the first time I need to use stored procedures with it.

My provider line in the webconfig is as follows:

I am using two providers pointing at two different databases, where the other one isn't calling the SPs.

When I generate, I am getting all the tables and the class storedprocedures's but it is empty! So when I do SPs. ... in code there are no classes to display.

Does anyone know what's happening here?

UPDATE:

If I set UseSps="True" on my other provider.. it does work?

The databases are on completely different servers..

Bex

A: 

I'm assuming you're using version 2.X of subsonic, not 3 ?

If so, you need to tell your config to generate stored procs, something like this:

 <SubSonicService defaultProvider="blah">
        <providers>
            <clear />
            <add 
 ...
 includeProcedureList="proc1,proc2"

If you're using version 3 you just need to run the T4 template for stored procs.

Matt Roberts
I am using 2, sorry should have said that!I have tried that, but it makes no difference.The other provider generates the SPs just fine, but the provider I actually need the sps from just creates an empty storedprocedure.cs with a whole load of using statements, but no class.
Bex
can you post your provider config?
Matt Roberts
yep <SubSonicService defaultProvider="Website"> <providers> <clear/> <!-- Provider --> <add name="Website" type="SubSonic.SqlDataProvider, SubSonic" connectionStringName="connstr" generatedNamespace="Test" useSPs="true" includeTableList="ClubWebsite"/> <add name="wru" type="SubSonic.SqlDataProvider, SubSonic" connectionStringName="wruconnstr" generatedNamespace="Wru" useSPs="true"/> </providers> </SubSonicService>(hope this posts alright here..)
Bex
it's the wru one that's not working
Bex
Hmm - all I can say is that we don't bother to specify useSps="true", we just use the includeProcedureList attr to specify what we need, and it works. Maybe one of your stored proc trips up subsonic, you could try to use the includeProcedureList and just try one simple proc?
Matt Roberts
:( no worky! Simple sp called testprovider line now reads <add name="wru" type="SubSonic.SqlDataProvider, SubSonic" connectionStringName="wruconnstr" generatedNamespace="Wru" includeProcedureList="test"/>
Bex
A: 

Right- for anyone who's got this problem.. I know what's causing it (in my case anyway).. will need a core code rewrite to fix..

If you go here it shows the source for generating the Sps. Go to line 1745

If I run this procedure in SQL Server I get this error:

Cannot sort a row of size 8098, which is greater than the allowable maximum of 8094.

Its because the stored procedures in the DB I am using are absolutely massive, so they are too long for the row when it orders by. Removing the order by in the core code will fix that error, but I don't know if it's needed??

I am going to submit it as an issue.

Bex
Glad you sorted this, although I'm not sure why you said it still borked when you tried it on a simple test SP
Matt Roberts
No idea..! Bit strange! Doing it the "old fashioned" way now.. using the good ol' dataadapter .. hmmm!
Bex