Last post Jul 15, 2009 08:03 AM by Johnny_Boy
Jul 15, 2009 03:59 AM|Johnny_Boy|LINK
I have a stored procedure that works with a live site perfectly.
However, I wish to change the procedure to include more parameters, but from previous tryouts it resulted the site throwing SqlException of message "Parameter count does not match parameter value count". The change was adding a parameter with default value,
but it seems that the SqlHelper checks the actual parameter count prior to setting the variables.
What I had to do in these case is to create another stored procedure with a suffix of "_temp", testin it with it, publishing the site again and then copying the "_temp" procedure to the live one for the changes to take affect.
Is there a better solution for this ? What would you do if you were me ?
Jul 15, 2009 05:06 AM|uid895650|LINK
Are you using datasets / tableadapters? I have had a similar problem and had to redo the whole thing when I have added more fields. Also, how are you displaying the data i.e. IDataReader etc...
Jul 15, 2009 05:09 AM|nileshdeokar|LINK
delete temp files from "C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files"
also add new parameters at the end only with default values other wise it throws error or it will not assigned values properly.If possible post 4-5 lines of your SP so I can help you
Remember to click “Mark as Answer” on the post, if it helps you. Because It helps others to find the solution
Jul 15, 2009 06:12 AM|TATWORTH|LINK
This is a where a separate data layer becomes very useful. If usp_PersonSelect is called by the SelectRecord method in Person.cs, make a new stored procedure usp_PersonSelect2 called by SelectRecord2. You can now unit test the new routine and then progressively
migrate from SelectRecord to SelectRecord2.
Jul 15, 2009 08:03 AM|Johnny_Boy|LINK
That's what I wish to avoid. Migrating from say SelectRecord to SelectRecord2.
I want to still be using SelectRecord.
If that's not possible, then I have two options:
1) Create another exact SP to work on, and after testing upload the new code that handles the extra parameters and immediately after alter the main SP to be exactly as the backup one. Then just delete the backup.
2) Try to edit the SqlHelper's code and remark the code that checks for parameter count.
I suppose no one has a #3, #4 ... solutions ..