Closed damienmartel2 closed 5 years ago
Is the column idBac an autonumbering column? As you defined it on the database should be autonumbering.
You can also enable debugging (Jet provider writes the queries befor run them). The statement to enable debugging should be JetConnection.ShowSqlStatements = true (remember to disable it, otherwise the application could be very slow).
You can also try to create a new DB using standard migrations (if you don't disable it, EF creates the database on first access).
Try also to compact the database.
First thank you for your help ;)
The column idbac is not autonumbering but if i remove the key attribute i have an error when the context is loaded...
JetConnection.ShowSqlStatements = true
i add this code but how to track queries ?
JetConnection.ShowSqlStatements = true
i add this code but how to track queries ?
The queries are tracked on the console. You need to redirect it if you are using a web server
First thank you for your help ;)
The column idbac is not autonumbering but if i remove the key attribute i have an error when the context is loaded...
You are welcome! With this configuration you need to have the idbac column autonumbering. If you don't want to have an autonumbering column, You can set the column not to be database generated (DatabaseGenerated attribute). In this case you need to set bac.IdBac = x before saving changes.
The issue is not really related to the provider. You have the same problem using SQL. You probably could have better support on stack overflow
the request tracking
ExecuteDbDataReader========== insert into [Bac]([idScanner], [bacNo]) values (@p0, @p1); select [idBac] from [Bac] where [idBac] = @@identity @p0 = 0 @p1 = 0
It works ! Just i add the attribute ;)
A big thank you for your help ! Good day to you ;)
[Table("Bac")]
public class BacEntity
{
[Key]
[DatabaseGenerated(DatabaseGeneratedOption.None)]
[Column("idBac")]
public int IdBac { get; set; }
[Column("idScanner")]
public int IdScanner { get; set; }
[Column("bacNo")]
public short BacNo { get; set; }
}
I am trying to use your provider to work with access database (version Microsoft.Jet.OLEDB.4.0). Select and update operations work very well but when i try to insert an element i have an error when i call the SaveChanges() methods...
the error is : Store update, insert, or delete statement affected an unexpected number of rows (0). Entities may have been modified or deleted since entities were loaded. See http://go.microsoft.com/fwlink/?LinkId=472540 for information on understanding and handling optimistic concurrency exceptions.
The mdb database is a model with existing tables and no records...
Could you help me ?