Contributions
Re: Trying to get SQL Exception using "ADO.CreateADOCommand"
Hi!:smileyhappy: I'm also not an expert, but in more common development tools we often have this database return, about when we have a "integrity constraint," for example. Not even in this case do I get a response using "ADO". For this reason I am believing that using another driver to connect with the database could raise these exceptions.:smileyindifferent: Maybe there is another way in TestComplete itself that I do not know, so here I am trying to understand how it works. TestComplete is a great tool for developing scripts, I can not believe I can not do this.:smileysad:1.9KViews0likes1CommentRe: Trying to get SQL Exception using "ADO.CreateADOCommand"
Hi, Robert. What alternative would you use to solve this problem? Do we only have "ADO" to send instructions to the database with TestComplete? Making a subsequent query does not seem to be a good practice, because each case will require a specific subsequent query, and I will not have how to predict everything. Does TestComplete accept the use of other connection drivers like DBExpress for example? Thank You.1.9KViews0likes3CommentsRe: Trying to get SQL Exception using "ADO.CreateADOCommand"
Hello, Robert, Thanks for your response.:smileyhappy: I'm not sending a query to the database expecting a set. Imagine that Delphiscript is sending an SQL statement as a "Restore Database TC from Database_Snapshot" or an "insert". Assuming that in 1st case the path to the backup file to be restored is not available at that time and the 2nd "insert" is prevented by integrity constraint. The delphiscript would only wait for the completion of the execution of the SQL statement that was sent, if execution is prevented for some reason. Should this reason not be raised as an exception? If this is not how it works, how will I know if it has failed or not? Thank you.:smileyvery-happy:2KViews0likes7CommentsTrying to get SQL Exception using "ADO.CreateADOCommand"
Hello there; This is my first topic of doubt. I have been researching for some time without a solution and so I decided to ask, because even with some research inside and outside the Smartbear community I could not find a solution.:smileysad: I am trying to execute an SQL statement in SQLServer through the existing ADO.Command in TestComplete, expecting the return of an exception. The database only returns if there is a syntax error. However, if the syntax is correct, but the operation can not be performed, the database is not returning the exception. Just with the return of the exception I can handle the situation in my code. Test execution needs to stop if the database fails to execute the statement I submitted to it. Exemplifying: I tried to use "try-except" in my delphiscript, but the database is not returning the exception forcing it to drop directly on the except line. (Neither using a division-by-zero statement) I've also tried to create a T-SQL with a "try-except" forcing a raiserror, but even then, I'm not able to catch the exception. I have looked at the properties in the ADO.CreateADOCommand and there is apparently no property to flag the exception. I am believing that the database suppresses this information and it is not returning to the application. Or maybe I'm failing at something I have not yet observed. Could anyone tell me what might be happening? And how could I solve this to get the exception I hope so much? Thank you.:smileyhappy:2KViews0likes9Comments