Your example is incompatible because you have DataObjectTypeName set, but your LeasesDS_Inserting method adds parameters as if it weren’t.
If you do not need the name DataObjectTypeName, you can delete it, and then you will have a better chance that this will work.
If you need a DataObjectTypeName or just prefer it (like me), there is a way to make this work, but it is not very.
In your LeasesGrid_RowCommand method, you can use code like this to get an idea:
IDataSource ds = (IDataSource)LeasesDS; DataSourceView view = ds.GetView(LeasesGrid.DataMember);
After receiving the view, you can create a dictionary containing the values that must be written to the data object, which will ultimately be passed to your Insert method. The code for this will be very similar to what you have in LeasesDS_Inserting, but you will embed in your own dictionary instead of e.InputParameters.
Once your dictionary is ready, you can call Insert in a view with something like this:
view.Insert(dict, delegate { return false; });
That should do it.
You no longer need the LeasesDS_Inserting method, because the Insert Insert method will do the job of converting the dictionary that you passed into the data object that it will pass into your Insert method.
If you need to process the properties of this data object more, you will see it in the dictionary of input parameters passed to LeasesDS_Inserting.
source share