Validation problem

Hi all,

I have to put validation points in my workflow where my BOT has to type BAN NUMBER after reading it from datatable.If the BAN IS NOT NUMERIC THEN bot will throw an error and log the exception in sql.
Can anyone please guide how can i validate this point and log the exception in sql.
If the BAN number is not numeric bot will not proceed further.

Kind regards

1 Like

You can try wrapping this compare activity within Try-Catch. If the control goes to catch section that means it is not numeric and from here you can log to SQL by adding database activities within catch

1 Like

if it is not numeric then i am using throw activity giving businessruleexception in catch block as i don’t want my BOT to proceed further.Can you please tell me how will i log these such exceptions in SQL.I mean how will it be done.can you provide some sample ?

1 Like

Hi @c.ciprian
can you please suggest in this as well.


@c.ciprian @Daniel can u help me as how to make my BOT log expections in sql database

@somya177 - You want to know if your variable has only numbers. Right? You can use IsNumeric(variable). It will return True/False if the variable has only numbers. Based on bool value please have the activities that writes to SQL

1 Like

Hi @acaciomelo ,

I want my BOT to log all the exceptions occurrred at the time of running the workflow in SQL database.
My bot should maintain a database file where it is logging all the exceptions.
Can you please help in this and let me know how it can be done?

Hi @somya177,

I would suggest you to install the package below. It basically contains database related activities, therefore you may connect with your SQL database and insert whatever information you need.

Once you have it installed, you may check it here:

so i have installed this…so now the concern is that i am using try catch activity and in catch if any exception occurs BOt will throw the exception and for that i have used Throw activity.
After that i need my BOT to log that exception in sql datatable so do i need to use INSERT activity of database everytime in the catch blocks in the workflow?
do you have any sample where you are inserting data into sql through UiPath?
will be great help

Hi @somya177,

Yes, you will get the exception details like exception.Message and insert into the database.

Please refer to:

@somya177 - Do you need to Throw the exception when you are already logging the error into the database? What are you doing with the exception thrown?

currently i am unable to do logging exception in sql so i am throwing.can you please help me in how can i log my exceptions in sql database?

@somya177 - Please check the attached sample file. Hope it helps you to proceed. You can also wrap the db insert activity into another try catch.

LogErrorToDB.xaml (8.2 KB)


so if i am using db insert activity into another try catch do i again need to follow these 3 steps of connect,exec and disconnect to make my bot log exceptions into the same database file?

1 Like

@somya177 - No, you do not need to again follow the 3 steps. You can just log the exception, if any, to know if there are any issues in connecting to database

i didn’t get this…
In my first try catch of one workflow i have done all the three steps.
now in my second workflow try catch i have to repeat all the sql steps in the catch block. right?

@somya177 - Please use the DB activities inside a catch block wherever you want to log the exception into a DB table. Hope this clarifies.



when i am running my execute non-query i am getting this error:
Execute Non Query: Incorrect syntax near ‘DPD’.

What is the query that you are executing… try to form the query dynamically, print the query and try to execute the same in SQL and see if it works.