StrataFrame Forum
Home      Members   Calendar   Who's On
Welcome Guest ( Login | Register )
      



Saving Data via Stored ProceduresExpand / Collapse
Author
Message
Posted 01/17/2006 12:09:21 PM
StrataFrame Beginner

StrataFrame BeginnerStrataFrame BeginnerStrataFrame BeginnerStrataFrame BeginnerStrataFrame BeginnerStrataFrame BeginnerStrataFrame BeginnerStrataFrame Beginner

Group: Forum Members
Last Login: 11/16/2006 1:23:18 PM
Posts: 40, Visits: 85
Hi All

Do you have any samples or documentation on using sprocs to do data manipulation through a business object?

I'm using a sproc to fill the datatable and I see options in the business objects for DeleteUsingStoredProceure / DeleteStoredProcedureName etc but I'm not sure how these work.

I've not had a chance to test this but I'm assuming that I'll need to leave dbWriter permissions open to the tables if I'm going to allow the BO to do the data manipulation. Is this correct?

Thanks much

Clay

Post #437
Posted 01/17/2006 4:24:37 PM


StrataFrame Developer

StrataFrame Developer

Group: StrataFrame Developers
Last Login: Today @ 11:24:42 AM
Posts: 2,686, Visits: 1,889
Clay,

Yes, I'm actually writing the documentation on the C.R.U.D. setting right now... how ironic. Yes, whatever login you use to connect to the SQL Server will have to have write permissions on the database to be able to save the records.

I've attached the script file I use to create the stored procedures for our unit testing. Basically, you just have to follow these rules:

1). The UPDATE and DELETE stored procedures need to use the same concurrency type as the business object is set to.
a). If you're using row versioning or timestamp, you need to pass accept the row version or timestamp column and check the value.
2). Any output value (new row version value, assigned identity value, etc.) needs to be returned through an output parameter.
3). Use the field names for the parameters with a common prefix. The StoredProcedureParameterPrefix property allows you to set the prefix that you want to use (defaults to just '@').

Just take a look at these stored procedures and I'm sure you'll get the idea of what you'll need to do. (Until I get you the new CHM with examples )


www.bungie.net

  Post Attachments 
SqlCrud.zip (55 views, 2.49 KB)
Post #440
Posted 01/17/2006 5:10:16 PM
StrataFrame Beginner

StrataFrame BeginnerStrataFrame BeginnerStrataFrame BeginnerStrataFrame BeginnerStrataFrame BeginnerStrataFrame BeginnerStrataFrame BeginnerStrataFrame Beginner

Group: Forum Members
Last Login: 11/16/2006 1:23:18 PM
Posts: 40, Visits: 85
Thanks much...

So for example, when I create an Insert or Update sproc, I will need to have the parameters mirror the fields in the table both in order and type.  From there, will the BO take care of the rest?

Post #444
Posted 01/18/2006 8:43:48 AM


StrataFrame Developer

StrataFrame Developer

Group: StrataFrame Developers
Last Login: Today @ 11:24:42 AM
Posts: 2,686, Visits: 1,889
I will need to have the parameters mirror the fields in the table both in order and type


Just name and type... the order is irrelavent. On the parameter names, you can add any prefix to the field name you like. For instance, if your primary key field is UserID, then you can set your parameter name to @p_UserID or just @UserID. Just set the StoredProcedureParameterNamePrefix property to the correct value...


www.bungie.net
Post #447
« Prev Topic | Next Topic »


Reading This TopicExpand / Collapse
Active Users: 0 (0 guests, 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 12:54pm

Powered by InstantForum.NET v4.1.4 © 2008
Execution: 0.125. 9 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.