Bonjour
Voilà, j'ai un problème en ce moment pour insérer des données dans une table.
Je veux insérer dans la table EtudiantsLogiciels
1 2 3 4 5 6 7 8 9
| CREATE TABLE [dbo].[EtudiantsLogiciels](
[codePermanent] [char](12) NOT NULL,
[noLogiciel] [int] NOT NULL,
[clefPortfolio] [char](15) NULL,
[version] [varchar](500) NOT NULL,
CONSTRAINT [PK_EtudiantsLogiciels] PRIMARY KEY CLUSTERED
(
[codePermanent] ASC,
[noLogiciel] ASC |
Le problème est que la clé primaire codePermanent n'est pas relié à une autre table. Je veux quand même insérer en settant une valeur.
Erreur
object references an unsaved transient instance - save the transient instance before flushing. Type: ePortfolio.Data.Portfolio.Portfolio, Entity: ePortfolio.Data.Portfolio.Portfolio
1 2 3 4 5 6 7
| Public Sub New()
Table("EtudiantsLogiciels")
CompositeId().KeyReference(Function(x) x.Logiciel, "noLogiciel").KeyReference(Function(x) x.Portfolio, "codePermanent")
'References(Function(x) x.Logiciel, "noLogiciel")
'References(Function(x) x.Portfolio, "codePermanent")
Map(Function(x) x.Version, "version")
End Sub |
1 2 3 4 5 6 7 8 9 10
| Public Sub New()
Table("portfolios")
Id(Function(c) c.ClefPortfolio, "clefPortfolio")
Map(Function(c) c.CodeNDS, "codeNDS")
Map(Function(c) c.CodePermanent, "codePermanent")
Map(Function(c) c.EstValide, "estValide")
Map(Function(c) c.DateValidee, "dateValidee")
Map(Function(c) c.EstAnglais, "estAnglais")
Map(Function(c) c.NoTypePortfolio, "noTypePortfolio")
End Sub |
Partager