Parameters collection for FillByStoredProcedure
 
Home My Account Forum Try It! Buy It!
About Contact Us Site Map
StrataFrame Forum
Home      Members   Calendar   Who's On
Welcome Guest ( Login | Register )
      



Parameters collection for...Expand / Collapse
Author
Message
Posted 04/28/2008 4:13:37 PM
StrataFrame User

StrataFrame UserStrataFrame UserStrataFrame UserStrataFrame UserStrataFrame UserStrataFrame UserStrataFrame UserStrataFrame User

Group: StrataFrame Users
Last Login: Yesterday @ 3:00:39 PM
Posts: 244, Visits: 816
How do I pass multiple parameters to the FillByStoredProcedure method?
Post #15966
Posted 04/28/2008 4:56:18 PM


StrataFrame Developer

StrataFrame Developer

Group: StrataFrame Developers
Last Login: Yesterday @ 3:24:00 PM
Posts: 3,733, Visits: 3,926
It is a ParamArray so you can just pass as many parms as you want or create an Object array....whichever works best for you:

MyBo.FillByStoredProcedure(Parm1, Parm2, Parm3)

or

MyBo.FillByStoredProcedure(New Object() {Parm1, Parm2, Parm3))
Post #15967
Posted 04/28/2008 5:06:18 PM
StrataFrame User

StrataFrame UserStrataFrame UserStrataFrame UserStrataFrame UserStrataFrame UserStrataFrame UserStrataFrame UserStrataFrame User

Group: StrataFrame Users
Last Login: Yesterday @ 3:00:39 PM
Posts: 244, Visits: 816
One of the data retrieval methods is MicroFour.StrataFrame.Business.BusinessLayer.FillByStoredProcedure(string, params System.Data.Common.DbParameter[]).  How do I pass a parameters collection?  Sorry, if I am not making myself clear.  Here is the code offending code in my BO:

public void FillByOrderIndex(int pPLType, int pOrderIndex)
{
     FillByStoredProcedure(
"spx_GetOrderItemList", pPLType, pOrderIndex);
}

Post #15968
Posted 04/28/2008 5:11:59 PM


StrataFrame Developer

StrataFrame Developer

Group: StrataFrame Developers
Last Login: Yesterday @ 3:24:00 PM
Posts: 3,733, Visits: 3,926
You have to supply a DbParameter.  If you are using SQL Server, then it would look something like this:

Me.FillByStoredProcedure("MyStoredSproc", New SqlParameter("@parm1", MyValue), New SqlParameter("@parm2", MySecondValue))
Post #15969
Posted 04/28/2008 5:21:56 PM
StrataFrame User

StrataFrame UserStrataFrame UserStrataFrame UserStrataFrame UserStrataFrame UserStrataFrame UserStrataFrame UserStrataFrame User

Group: StrataFrame Users
Last Login: Yesterday @ 3:00:39 PM
Posts: 244, Visits: 816
I did try this once:

SqlParameter mPLType = new SqlParameter("@pltype", pPLType);
SqlParameter mOrderIndex = new SqlParameter("@orderindex", pOrderIndex);
FillByStoredProcedure(
"spx_GetOrderItemList", mPLType, mOrderIndex);

It did not work...well, I didn't think it did.  It's a good thing to set the DataSourceKey on the BO, too.    It tends to misbehave when that is missing.  Once I put that back in, then both your code and my code works just fine.  Sorry for the oversight. 

Thanks for helping!
Bill

Post #15970
Posted 04/28/2008 5:44:01 PM


StrataFrame Developer

StrataFrame Developer

Group: StrataFrame Developers
Last Login: Yesterday @ 3:24:00 PM
Posts: 3,733, Visits: 3,926
No problem...glad you got it going
Post #15971
« Prev Topic | Next Topic »


Reading This TopicExpand / Collapse
Active Users: 1 (1 guest, 0 members, 0 anonymous members)
No members currently viewing this topic.
Forum Moderators: Ben Chase, Trent L. Taylor, Steve L. Taylor

PermissionsExpand / Collapse

All times are GMT -6:00, Time now is 2:26am

Powered By InstantForum.NET v4.1.4 © 2008
Execution: 0.063. 10 queries. Compression Enabled.
Site Map - Home - My Account - Forum - About Us - Contact Us - Try It - Buy It

Microsoft, Visual Studio, and the Visual Studio logo are trademarks or registered trademarks of Microsoft Corporation in the United States and/or other countries.