how to catch a exception from TMyCommand
-
- Posts: 20
- Joined: Fri 05 Aug 2005 12:20
- Location: Sweden
how to catch a exception from TMyCommand
hi
this is the code:
__fastcall TMySQLForm::TMySQLForm(TComponent* Owner)
: TForm(Owner)
{
try
{
MySQLModule->MyCommand->Execute(1);
}
catch (const EMySqlException &E)
{
this->SerchOpComboBox->Text = "error";
}
}
this is the error:
[C++ Error] MySQLMain.cpp(36): E2377 Catch statement missing )
I dont know if this is the correct way to catch a EMySqlException or not.
this is the code:
__fastcall TMySQLForm::TMySQLForm(TComponent* Owner)
: TForm(Owner)
{
try
{
MySQLModule->MyCommand->Execute(1);
}
catch (const EMySqlException &E)
{
this->SerchOpComboBox->Text = "error";
}
}
this is the error:
[C++ Error] MySQLMain.cpp(36): E2377 Catch statement missing )
I dont know if this is the correct way to catch a EMySqlException or not.
Last edited by mikrodidakt on Fri 05 Aug 2005 13:34, edited 1 time in total.
-
- Posts: 20
- Joined: Fri 05 Aug 2005 12:20
- Location: Sweden
Stupid me i forgot to include MySqlErrors.hpp
but now i get this
[C++ Error] MySqlErrors.hpp(43): E2238 Multiple declaration for '_fastcall EMySqlException::EMySqlException(int)'
[C++ Error] MySqlErrors.hpp(35): E2344 Earlier declaration of '_fastcall EMySqlException::EMySqlException(int)'
whats up with that
but now i get this
[C++ Error] MySqlErrors.hpp(43): E2238 Multiple declaration for '_fastcall EMySqlException::EMySqlException(int)'
[C++ Error] MySqlErrors.hpp(35): E2344 Earlier declaration of '_fastcall EMySqlException::EMySqlException(int)'
whats up with that
-
- Posts: 20
- Joined: Fri 05 Aug 2005 12:20
- Location: Sweden
what hpp file should i include then because when i am using EMyError or EMySqlException it never jumps to catch, so it seems like the exception is caught some where else. the cod that i have used is
is this correct
Code: Select all
try
{
MySQLModule->MyCommand->Execute(1);
}//the message is printed here
catch (const EMyError &e)
{
this->SerchOpComboBox->Text = "error";
}
-
- Posts: 20
- Joined: Fri 05 Aug 2005 12:20
- Location: Sweden
Hi, thanks
I get a error now:
[C++ Error] MySQLMain.cpp(465): E2377 Catch statement missing )
which I interpreter as it does´t know MyError i have done the settings for
the project so the path to MyDac/include is set.
I tried to include both MyAccess.hpp and MyClasses.hpp but it did not work.
I get a error now:
[C++ Error] MySQLMain.cpp(465): E2377 Catch statement missing )
which I interpreter as it does´t know MyError i have done the settings for
the project so the path to MyDac/include is set.
I tried to include both MyAccess.hpp and MyClasses.hpp but it did not work.
Code: Select all
try
{
MySQLModule->MyCommand->Execute(1);
}
catch (const MyError &e)
{
this->SerchOpComboBox->Text = "error";
}
-
- Posts: 20
- Joined: Fri 05 Aug 2005 12:20
- Location: Sweden
-
- Posts: 20
- Joined: Fri 05 Aug 2005 12:20
- Location: Sweden
Code: Select all
try
{
AnsiString sqlStr = "use temp2;";
MySQLModule->MyCommand->SQL->Clear();
MySQLModule->MyCommand->SQL->Text = sqlStr;
MySQLModule->MyCommand->Execute(1);
}
catch (const EMyError &e)
{
this->SerchOpComboBox->Text = "error";
}
the exception is not caught it never gets to the catch statment