|
Post by jayantha on Jan 12, 2023 7:02:56 GMT
I did my first project successfully. Now I am in my 2nd .I tried hard to find the issue I think it is with primary key Any common advice please
SimpleSQL.SimpleSQLManager.Insert (System.Object obj, System.Int64& rowID) (at <9d351781d88446ec91fb4a6de237d175>:0) SimpleSQL.SimpleSQLManager.Insert (System.Object obj) (at <9d351781d88446ec91fb4a6de237d175>:0) SimpleSQL.Demos.insert_cus.SaveTable_stats (System.Int32 tid, System.String dr_title, System.String c_name, System.String c_age, System.String c_tp, System.String c_adr) (at Assets/MY SCRIPTS/insert_cus.cs:59)
line 59 >> dbManager.Insert(tableStats);
|
|
|
Post by echo17 on Jan 12, 2023 12:29:19 GMT
A constraint error is usually the primary key, but it could be other issues depending on how your database is set up. A primary key violation means you are inserting a duplicate value into your primary key field. Primary keys need to be unique. SimpleSQL is a Unity wrapper for sqlite, so you can find answers to sqlite issues on the internet. Here is a search to get you started: linkFrom that search I see this answer from someone: "It probably means your insert statement is violating a constraint in the new table. Could be a primary key constraint, a unique constraint, a foreign key constraint (if you're using PRAGMA foreign_keys = ON;), and so on. You fix that either by dropping the constraint, correcting the data, or dropping the data. Dropping the constraint is usually a Bad Thing, but that depends on the application."
|
|
|
Post by jayantha on Jan 12, 2023 15:48:12 GMT
Again thanks for your response .with your advice I rechecked and I found it. I have not inserted data correctly to one of the fields which is NOT NULL .
|
|