U++ framework
Do not panic. Ask here before giving up.

Home » U++ Library support » U++ SQL » MSSQL error management
Re: MSSQL error management [message #49648 is a reply to message #49642] Wed, 21 March 2018 15:25 Go to previous messageGo to previous message
mirek is currently offline  mirek
Messages: 14290
Registered: November 2005
Ultimate Member
Perhaps you can try this:

bool ImportData::InsertBody(myS_Table record)
{

PromptOK("InsertBody");

DLOG("InsertBody");
	Sql sql(mssql);
	sql.ClearError();
DLOG("A");
	try { 
PromptOK("Try");
DLOG("TRY1");
sql * Insert(My_Table)
					(My_Id, record.Id)
					(My_Row, record.Row)
					(My_Description, record.Description);
DLOG("TRY2");
				return true;
	} catch(SqlExc) {
PromptOK("In catch");
DLOG("CATCH1");
		ErrorOK(t_("Failed adding data to the database due to the following error: ") + SQL.GetLastError());
DLOG("CATCH2");
		return false;
	}
DLOG("NEVER HERE");
	return true;
}


Just to make sure prompts work as expected.

(Obviously report which ones of these display something...)

Mirek
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: ODBC crash
Next Topic: MSC configure with VS 2017 Professional
Goto Forum:
  


Current Time: Wed Apr 29 22:19:44 GMT+2 2026

Total time taken to generate the page: 0.01177 seconds