Value of type 'String' cannot be converted to 'UiPath.Database.DatabaseConnection

Value of type ‘String’ cannot be converted to 'UiPath.Database.DatabaseConnection

Hi @Aditya10989

The error message you provided suggests that there is an issue with converting a string value to a UiPath.Database.DatabaseConnection object. This error occurs when you try to assign a string value to a variable that expects a DatabaseConnection object.

Please provide us some more info on this, so that we can find out the root cause.

Hope this helps,
Best Regards.

Maybe you can elaborate more on what is tried and what was done so far.

In general, we use a connection string within a Connect to Database activity and can get back a Conenction

I want to disconnect db after performing sql activity.Run Query is working but now I am passing db connection to disconnect activity its throwing error because in run query we have connection in string format and disconnect activity its looking for UiPath.Database.DatabaseConnection

Hi @Aditya10989 ,

Generally when you use connect to database activity the ouput type of the activity is of type UiPath.database.databaseconnection .

Pass the same variable output as input to activity
disconnect from database .

Hope this helps

1 Like

@AutomationX_by_Kiran but we are passing connection from json and its reading connection string as string


Hi @Aditya10989 ,

u are passing from json the sql authenication details ??

we have config.json file from where we are fetching connection string. after fetching we are getting output in string


Connecting String in string type is fine, pass it to connect datatabase activity, take output from connect and pass same to disconnect activity.


@prateek.mehandiratta9 but disconnect taking input database connection

Hi @Aditya10989 ,

You are getting the connection string from json right pass it in the
Connect database
Then u will get the output as dbconnection variable .

Pass that variable in the disconnect database .

So what ever you are getting in json don’t pass in disconnect database

1 Like

when I am executing run query getting error Run query: Only one of the connections can be used.


Hi @Aditya10989

try removing the provider name, just leave the existin connection in the run query property


1 Like

its working after restart studio

@AutomationX_by_Kiran thanks

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.