Home » U++ Library support » U++ SQL » SQLCommander make program crash
|
|
Re: SQLCommander make program crash [message #17663 is a reply to message #17659] |
Mon, 25 August 2008 08:32 |
TeCNoYoTTa
Messages: 138 Registered: July 2008 Location: Egypt
|
Experienced Member |
|
|
I use Sqlite3 and in this is the constructer of my window
CISL::CISL()
{
CtrlLayout(*this, "CISL");
this->WhenClose = THISBACK(Hide);
this->MinimizeBox();
///////Opening DataBase
if (!sqlite3.Open(ConfigFile("simple.db")))
{
Exclamation("Can't Open Dataabse");
return;
}
SQL = sqlite3;
SqlSchema sch(SQLITE3);
StdStatementExecutor se(sqlite3);
All_Tables(sch);
if (sch.ScriptChanged(SqlSchema::UPGRADE))
Sqlite3PerformScript(sch.Upgrade(),se);
if (sch.ScriptChanged(SqlSchema::ATTRIBUTES))
{
Sqlite3PerformScript(sch.Attributes(),se);
}
if (sch.ScriptChanged(SqlSchema::CONFIG))
{
Sqlite3PerformScript(sch.ConfigDrop(),se);
Sqlite3PerformScript(sch.Config(),se);
}
sch.SaveNormal();
tray.WhenBar = THISBACK(TrayMenu);
btn_download <<= THISBACK(OpenDownloadManager);
btn_add <<= THISBACK(OpenAddWindow);
list_items.AddKey();
list_items.Add("title");
list_items.Add("Author");
list_items.Add("Status");
SQL*Select(SUBJECT_ID,SUBJECT_NAME).From(CIS_SUBJECTS);
while (SQL.Fetch())
{
droplist_subject.Add(SQL[0],SQL[1]);
}
SQL*Select(TYPE_ID,TYPE_NAME).From(SUBJECTS_TYPES);
while (SQL.Fetch())
{
droplist_type.Add(SQL[0],SQL[1]);
}
/////////////////////////////////////////////////////
droplist_subject.WhenAction = THISBACK(droplist_change);
droplist_type.WhenAction = THISBACK(droplist_change);
//////////////////////////////////////////////
if (!droplist_subject.IsNullInstance())
droplist_subject.SetIndex(0);
if (!droplist_type.IsNullInstance())
droplist_type.SetIndex(0);
droplist_change();
list_items.WhenLeftDouble = THISBACK(OpenItemNotesWindow);
SQLCommander();//This make it crash
}
|
|
|
Re: SQLCommander make program crash [message #17664 is a reply to message #17663] |
Mon, 25 August 2008 10:49 |
TeCNoYoTTa
Messages: 138 Registered: July 2008 Location: Egypt
|
Experienced Member |
|
|
strange
when i commented this function ( i mean commented it's call in constructor)
void CISL::droplist_change()
{
text_title.SetText(droplist_subject.Get().ToString() +"-"+ droplist_type.Get().ToString());
SQL*Select(ITEM_ID,ITEM_TITLE,ITEM_AUTHOR
,Count(Select(SqlAll()).From(FILES).Where(FILE_ITEM_ID == ITEM_ID && IS_DOWNLOADED == true))
,Count(Select(SqlAll()).From(FILES).Where(FILE_ITEM_ID == ITEM_ID))).GroupBy(ITEM_ID,ITEM_TITLE,ITEM_AUTHOR);
while (SQL.Fetch())
{
list_items.Add(SQL[0],SQL[1],SQL[2],(SQL[3].ToString()+"/"+SQL[4].ToString()));
}
}
code worked
|
|
|
Re: SQLCommander make program crash [message #17678 is a reply to message #17664] |
Mon, 25 August 2008 18:07 |
|
mirek
Messages: 13976 Registered: November 2005
|
Ultimate Member |
|
|
TeCNoYoTTa wrote on Mon, 25 August 2008 04:49 | strange
when i commented this function ( i mean commented it's call in constructor)
void CISL::droplist_change()
{
text_title.SetText(droplist_subject.Get().ToString() +"-"+ droplist_type.Get().ToString());
SQL*Select(ITEM_ID,ITEM_TITLE,ITEM_AUTHOR
,Count(Select(SqlAll()).From(FILES).Where(FILE_ITEM_ID == ITEM_ID && IS_DOWNLOADED == true))
,Count(Select(SqlAll()).From(FILES).Where(FILE_ITEM_ID == ITEM_ID))).GroupBy(ITEM_ID,ITEM_TITLE,ITEM_AUTHOR);
while (SQL.Fetch())
{
list_items.Add(SQL[0],SQL[1],SQL[2],(SQL[3].ToString()+"/"+SQL[4].ToString()));
}
}
code worked
|
Usually, the error is a sign that you are trying to Fetch after errornous SQL.
I recommend you to activate log ("SetTrace") and check it after the crash.
Mirek
|
|
|
|
Goto Forum:
Current Time: Fri May 10 00:24:56 CEST 2024
Total time taken to generate the page: 0.02328 seconds
|