You are not logged in.
Pages: 1
I have a small project here where I included everything in one program because it only is about updating a single file with a text field.
My problem is that when the server tries to add a record I'll get an error which says in short: "Cannot insert explicit value into ----- when IDENTITY_INSERT is set to OFF"
I'm running Delphi11 and MSSQL.
Links to part of the code: [URL https://1drv.ms/u/s!AkzgaKIeNifrhaQI3gC … A?e=SpWAz3 /url]
the error message: [URL https://1drv.ms/u/s!AkzgaKIeNifrhaQLwLN … w?e=02zydi /url]
Delphi-11, WIN10
Offline
This is a MSSQL specific question, very tied to the database itself.
Did you create the table with mORMot? I guess not.
Check the generated and executed SQL to find out where the problem comes from.
Why do you use fDBSever.Commit without any BeginTransaction?
It is not correct. Just make the Add or Update directly.
Also note that your code is leaking memory - e.g. the user: TSQLRecUsers is never freed.
Offline
Sorry, I fixed it by deleting the table and then run the program again. But Yes I created the table with mORMot but I also have tested different Restservers and it might have been created different then.
I tested TSQLRestClientDB but could not understand how I should set it up. As I don't use SQLITE this time I could not put a filename into the third parameter, I did try but then it created a db3-file with some strange marks ('v') on the tables.
Delphi-11, WIN10
Offline
Pages: 1