To be more specific, we are having a problem with autoincrementing values while inserting records. We need to utilize the facility in MM.NET for inserting negative integers into primary keys. Using the following code, MM.NET inserts the first record with a primary key of -1. Then, whle trying to insert the second record we get a duplicate key violation because MM.NET trys to insert another -1.
this.customer.NewEntity();
int test = (int) this.customer.GetPrimaryKeyValue();
this.customer.SaveEntity();
----
We would also like to know if this is the recommended way to utilize stored procedures for inserting data.
public LocationEntity SaveLocation(LocationEntity entity)
{
LocationEntity locationEntity = this.CreateEntityObject();
locationEntity = this.GetEntity("LocationInsert",
this.CreateParameter("@Address", entity.Address),
this.CreateParameter("@CategoryID", entity.CategoryID),
return locationEntity;
}
----
Finally, we are using this code with mmRADGrid and was wondering if this is correct.
if (e.CommandName.Trim().ToString() == "Insert")
{
mmTextBox txtName = e.Item.FindControl("txtName") as mmTextBox;
mmTextBox txtAddress = e.Item.FindControl("txtAddress") as mmTextBox;
location.NewEntity();
this.location.Entity.Name = txtName.Text.Trim().ToString();
this.location.Entity.Address = txtAddress.Text.Trim().ToString();
this.location.SaveLocation(this.location.Entity);
}
Regards,
Fred Chateau