Business Object SAVE() and Stored Procedures


Author
Message
Clayton Hoyt
Clayton Hoyt
StrataFrame Novice (66 reputation)StrataFrame Novice (66 reputation)StrataFrame Novice (66 reputation)StrataFrame Novice (66 reputation)StrataFrame Novice (66 reputation)StrataFrame Novice (66 reputation)StrataFrame Novice (66 reputation)StrataFrame Novice (66 reputation)StrataFrame Novice (66 reputation)
Group: Forum Members
Posts: 40, Visits: 85
When creating a business object there are properties for the Insert, Update, and Delete sprocs. Am I correct in the following assumptions...

  • Save without a Primary Key sent through will use the Insert Sproc
  • Save with a Primary Key sent through will use the Update Sproc
  • DeleteByPrimaryKey will use the Delete Sproc

I looked through the help and the forum and hope that this isn't easily spelled out somewhere and I am missing it. Since my db will not have any reader/writer permissions, its important that I get this right from the start.

Thanks!

Clay

Replies
Clayton Hoyt
Clayton Hoyt
StrataFrame Novice (66 reputation)StrataFrame Novice (66 reputation)StrataFrame Novice (66 reputation)StrataFrame Novice (66 reputation)StrataFrame Novice (66 reputation)StrataFrame Novice (66 reputation)StrataFrame Novice (66 reputation)StrataFrame Novice (66 reputation)StrataFrame Novice (66 reputation)
Group: Forum Members
Posts: 40, Visits: 85
Ok...I think I have this straight. BigGrin

To do an update would look something likethis

  • dim t as bo
  • bo.fill... (I would fill my Primary Key)
  • bo.edit
  • bo.field1 = "X"
  • bo.save()

To do an insert would be

  • dim t as bo
  • bo.add
  • bo.field1 = "Y"
  • bo.save()

To do a delete would be

  • dim t as bo
  • bo.deletebyprimarykey(z)

StrataFrame Team
S
StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)
Group: StrataFrame Developers
Posts: 3K, Visits: 2.5K
Yes, those will all work.  However, the semantics might be a little different.  When you have a UI and controls bound to a business object, you usually use Add(), Edit(), and DeleteCurrentRow().  However, if you're just modifying records programmatically, you can use NewRow(), [nothing] (since you can just change fields without calling Edit()) and DeleteByPrimaryKey as they are slightly faster since they circumvent the UI.
GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Threaded View

Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search