Retrieve a DB record based on form input

We recently received a question via email that relates to working with data in a database.

The user was able to create a SQL connection in Stadium, but he wanted to know how to combine that with a form input field to search for a specific record from a database table. (In his words: “after i put input id of article in TextBox to make a search with my query and show a name of article in a Label [control on a page]?”)

Do the following:

(Prerequisite: you have created a SQL connection to your database.)

  1. Create a query under your SQL connection by right-clicking on the connection in the Application Explorer and choosing New Query

  1. Create query parameters using the SQL syntax in the query normally used to indicate a parameter, i.e. @parametername.

  1. Add a button to your page and use the Click event to run this query.

  1. Drag the query from the Application Explorer into the click script and set the parameter to the query.

  1. Then use a SetValue action to set the label to the name of the article.

Also see:

Database Connector

Set Value script action