Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Help
Message
 
À
28/06/2007 09:06:47
Information générale
Forum:
ASP.NET
Catégorie:
The Mere Mortals .NET Framework
Titre:
Re: Help
Versions des environnements
Environment:
C# 2.0
OS:
Windows XP SP2
Network:
Windows XP
Database:
MS SQL Server
Divers
Thread ID:
01236253
Message ID:
01236638
Vues:
23
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
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform