# Retrieve a DB record based on form input

**URL:** <https://community.stadium.software/community/t/retrieve-a-db-record-based-on-form-input/31>\
**Category:** How To\
**Created:** [May 17, 2019, 9:50am UTC](https://community.stadium.software/community/t/retrieve-a-db-record-based-on-form-input/31 "2019-05-17T09:50:08Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![johann.coetzee](https://community.stadium.software/community/letter_avatar_proxy/v4/letter/j/8491ac/32.png) [@johann.coetzee](https://community.stadium.software/community/u/johann.coetzee)\
**Post date:** [May 17, 2019, 9:50am UTC](https://community.stadium.software/community/t/retrieve-a-db-record-based-on-form-input/31/1 "2019-05-17T09:50:08Z")

</div>

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

 ![image](https://community.stadium.software/uploads/default/original/1X/493a858b616f261a386b810441d874b5a42c1cc6.png)

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

 ![2](https://community.stadium.software/uploads/default/original/1X/6671fe9ae5935fcbcef81b0fccee9b230b2c38c7.png)

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

 ![3](https://community.stadium.software/uploads/default/original/1X/d19ce5a93356cdaf8188c187ee93fb3fc02f6fc5.png)

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

 ![4](https://community.stadium.software/uploads/default/original/1X/aab790f60cb1227ccbf7f820a7b3a8c0284390fd.png)

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

 ![5](https://community.stadium.software/uploads/default/original/1X/2d7c4f80bbaf41df275b5ce585bf16965d4b02a5.png)

**Also see:**

[Database Connector](https://stadium.software/docs/Connectors/DatabaseConnector)

[Set Value script action](https://stadium.software/docs/actions/SetValue)
