How to write an "if condition" to check if the database connection passed or failed

Hi,

Scenario:

  1. After connecting to a database and if the connection is successful then log message should be written in a text file as “passed” with current time stamp
  2. If the connection failed then log message should be written as failed in the same file with current time stamp.

For this condition, can someone assist me on how can i create a “if condition” to check if the connection is true or false and appropriate log message(passed or failed) is updated in the file

xaml file which i tried is attached for reference.databaseConnection1.xaml (6.7 KB)

At first you need to check the timeout about Database connection then put the connecting process in Try Catch block also need to set delay time for reConnect. If some exceptions is catched, write the log.

1 Like

Hi Venkat,

Instead using Connect Activity directly use the vb.net code to check the connection.
please go through the below sample file.
databaseConnection1.xaml (9.0 KB)

1 Like