Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
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: 13986
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: Sun Jun 16 22:40:48 CEST 2024

Total time taken to generate the page: 0.03682 seconds