I'm working on a c# project and I have created a Database with EntityFramework.
This is the Database:
public partial class BDDInterneEntities : DbContext
{
public BDDInterneEntities()
: base("name=BDDInterneEntities")
{
}
protected override void OnModelCreating(DbModelBuilder modelBuilder)
{
throw new UnintentionalCodeFirstException();
}
public DbSet<CapitalisationActuelle> CapitalisationActuelle { get; set; }
public DbSet<DonneesDUMP> DonneesDUMP { get; set; }
public DbSet<PMRQTOTMGPS> PMRQTOTMGPS { get; set; }
public DbSet<Resultat> Resultat { get; set; }
}
This is my main function:
public partial class MainWindow : Window
{
private BDDInterneEntities cnn = new BDDInterneEntities();
public MainWindow()
{
SampleSolution(cnn.CapitalisationActuelle, cnn.DonneesDUMP, cnn.Resultat);
}
private void SampleSolution(DbSet<CapitalisationActuelle> cap, DbSet<DonneesDUMP> don, DbSet<Resultat> res)
{
foreach (var donneesDump in don)
{
if (!cap.Any(c => c.PMRQTOTM == donneesDump.PMRQTOTM))
{
var result = cap.Any(c => don.Any(c1 => c1.PMRQTOTM == c.PMRQTOTM));
}
res.SqlQuery("INSERT INTO resultat VALUES 'CapitalisationActuelle'" && donneesDump.Groupe_D_alerte &&");
}
}
On the method SampleSolution, I'm trying to perform a
DbSet<Resultat>.SqlQuery("INSERT INTO resultat VALUES 'CapitalisationActuelle'" && donneesDump.Groupe_D_alerte &&")
The problem is, I cannot use the && to insert variable values into my table Resultat.
Somebody knows how to insert, on c#, severals variable datas into the table Resultat?
Thanks in advance, Hope I gave enough details.
Greetings.