forlano Messages: 1185 Registered: March 2006 Location: Italy
Senior Contributor
sergeynikitin wrote on Tue, 16 March 2010 22:24
Try as this code
c16::c16()
{
CtrlLayout(*this, "Window title");
Sqlite3Session sqlite3;
if(!sqlite3.Open(ConfigFile("c16.db"))) {
Exclamation("Can't create or open database file");
return;
}
//#ifdef _DEBUG
sqlite3.SetTrace();
//#endif
SQL = sqlite3;
SQL.Execute("INSERT INTO PUNTI_GIOCATORI (IDCIRCOLO,SIGLAPROV,SIGLAREG) SELECT IDCIRCOLO,SIGLAPROV,SIGLAREG FROM ISCRITTI;");
btnFill.WhenPush = THISBACK(FillRankingTables);
}
It seems that you are adding records to the database and violate the unique key. Similar entries being added keys are already present in the database. It is necessary to exclude from the query a key field. For SQL Server is not important, but with SqLite such a conflict arises.
Thank you for your effort.
Unfortunatly it does not work.
I tried even to drop the table PUNTI_GIOCATORI and create a new one without primary key.
The weird thing is that the same instruction is parsed correctly by sqlitemanager and fill the table as expected.
I will try to break the instruction in two easy ones in the next days. I suspect there is some strange behaviour in the sqlite package.