高分找人!!!!
sqlerr.txt
上面这个文件是什么,有什么作用???在那里可以找到,希望得到您完整详细的答复
因为我做的一个查询功能,开始还是好的,但是,我把我原来的数据库更改以后,一查询就死机!!!
有下面的代码!!!
int __fastcall TForm1::ExecuteSQL( AnsiString SqlString, int Flag )
{
int iResult = 0;
try
{
CloseSQL();
// ShowMessage(SqlString);
if ( ! ADOQuery1->Active )
{
ADOQuery1->SQL->Clear();
ADOQuery1->SQL->Add( SqlString );
if ( Flag == 1 )
{
ADOQuery1->Open();
if ( ADOQuery1->Active )
iResult = 1;
}
else {
iResult = ADOQuery1->ExecSQL();
}
}
}
catch( Exception &E ){
FILE *fp;
if((fp=fopen("..//data/sqlerr.txt", "a+"))==NULL){
fclose(fp);
ShowMessage(AnsiString("Can't open ../data/sqlerr.txt!!"));
return false;
}
iResult=-1;
fprintf(fp, "%s: [%d]%s\n%s\n", Today, E.HelpContext, E.Message, SqlString);
fclose(fp);
}
return iResult;
}
//---------------------------------------------------------------------------
void __fastcall TForm1::CloseSQL()
{
try
{
if ( ADOQuery1->Active )
ADOQuery1->Close();
}
catch( ... )
{
if ( ADOQuery1->Active )
ADOQuery1->Close();
}
}