We’re using Ranorex to test a new application that posts data in widgets from a DB source from a search by an identifier.
from an excel file without resorting to multiple test recordings with corresponding data connectors for each identifier.

We made a global parameter for the identifier and variable can bind it to the test case and SQL data connector.

We next would use a table with a list of identifiers we want to test that would pass the identifier for each iteration.

The main question is how to pass the variable to the query in the data connector of each iteration of the identifier to avoid using multiple data connectors for each identifier.

Are there code examples for passing these parameters to the data connector?

You would have to put this code in a user-code module and place the module at a point in the parent test case right before the use of the named connector. You could then add module variables to the module and bind them to the parameter or data connector value of the parent that you need.

So, if I wanted to change my connector that is named "DBConnector1" and insert the query "select * from myTable where id=12", I would do the following:

I actually have this in a library that I use constantly. This does mean that you would need a "manipulator" module (what I call them) for each connector you need to manipulate at runtime.

Note, there are changes planned for how data connectors are handled. According to the Ranorex road map, these should be happening in 6.1 or 6.2, depending on what the Ranorex team can do with them and whether they think it's ready. This may allow for a more out-of-the-box way to handle this.