Set up a Data Connection in Linx

When using Linx, one often needs to connect to a database to perform queries, searches and updates. Within a single solution one would need to make multiple different calls to a database and it will take a lot of time if one needs to set up the connection every time.

Even worse, if at some future point you’d like to change the data source of your project, maybe a different server or username and password, you’d need to go to every single database function in your project and change it there.

That’s why, general practice when using Linx, is to set up the connection string as a Setting, and then re-use that setting every time. To set up the Connection String setting, in your project:

  1. Access a process and add an ExecuteSQL function.

  2. Then go to the properties and click on the “Connection String Wizard” button next to Connection String.

  3. The Data Link screen will show and you can select your data source from the list.

  4. On the next screen you then need to set up your data source’s properties

  5. Once you’re satisfied with the properties you can test whether the connection works.

  6. After setting up your connection, the Connection String property will now contain your configured string. In this case the string was:

“Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=Northwind;Data Source=USER-PC\SQLSERVER2012”

  1. Copy this string (Ctrl-C) and click on the Settings button on the top toolbar.

  2. Now we can configure a new setting and name it whatever we need to, in this case “DBConnection”. Paste (Ctrl-V) the connection string into the setting’s value field.

  3. This new Setting, called “DBConnection” can now be used in any database function by choosing $.Settings and DBConnection.