Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Newbie Add,Edit,Delete with a business object
Message
 
To
04/05/2005 12:14:02
Scott Butts
Ims Specialty Services
Twin Falls, Idaho, United States
General information
Forum:
ASP.NET
Category:
The Mere Mortals .NET Framework
Miscellaneous
Thread ID:
01010823
Message ID:
01011025
Views:
16
Scott!!!

How the H3!! r U!!! I have seen you in years! You going to Long Beach this Saturday? Hope all is well - short answers below. Hope they help.

-v

I have created a business object and set RetrieveAutoIncrementPK = true, database and table name, created a method to retrieve records by ID. This all seems to work. The problem I am running into to is actually using the business object on my form to edit and add data. After creating and registering (RegisterPrimaryBizObj) my business object with my form (mmBusinessForm) I call the GetEmptyDataSet method and the fields on my form that are tied to the business object are disabled, except my check boxes. Why are my check boxes still enabled?

Make sure you have the source set correctly on the check box - that's been the only time I have the mmCheckBox misbehave on me.

To add new records I have tried using both a mmButtonNew and adding code to mmButton, as in the jump start, making a call to the business objects NewRow method. This appears to be adding records fine once save is called but the ID field (which is marked as the key field) gets a value of 0 initially then once the record is saved the value changes to the correct new primary key value. How to I get the correct primary key value when the NewRow method is first called? Should I be calling the NewRow method from the business object directly? Is there a sample in the developers guide other then the Jump Start on adding records using business objects?

The PK Value of 0 prior to saving is the default behavior of ADO.NET - in order to pre-fetch your keys you'd have to manage the PK's yourself.

My next question is once a new record is added and saved, repeated calls to NewRow appears to added new records in the current business objects dataset but how do I navigate off the current record and to the newly added record?

Depending on the situation, you can easily assume that the next newly added record will always be the last in the datatable - it's ugly but here's one way: dataset.tables["yourtable"].rows.length -s will get you the last row on the table.

Looking at the jump start a data grid is used and the grids NavigateData method is called. I am not using a datagrid on this form. Shoould I be using it for navigating records? If I make it visible = false when the form is loaded the grid is still visible.

One last question, I am using a mmPicker object to allow the user to select a record to edit. When the picker form is displayed the user is able to change the data that is being displayed, how to I disable this feature?


Try looking at the Northwind sample project - there is a pretty cool maintenance form you can probably make good use of.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform