# 画面にDBクエリの追加

Dashcombがサポートしているデータベースを利用し、既に作成した画面に対して複数のDBクエリを追加することが可能です。DBクエリを使って、画面とデータソースの連携が実現できます。

## 準備

* データソースリストにこれから使うデータベースを追加しておきます。
* このDBの連携先になる管理画面を作成しておきます。

## 実現

* [クエリ領域](/dashcomb-help-center/ide/query-region.md)で「DBクエリ」タブをクリックします。
* 「+」アイコンを押して、DBクエリ名を作成します。
* データソースリストから対象のデータベース接続先を選びます。
* 「実行前アクション」に「アクション無し」、「確認」、「承認」を選べることができます。
  * ここでは初期の「アクション無し」を選びます。
* 事前に用意したSQL文を書き込みます。
* `{{}}` を使って管理画面要素の値を取得し、SQL文の該当項目に引数として埋め込みます。
  * （例）`{{input1.value}}`
* 「成功時」、「失敗時」の「アクション」や「通知」を設定します。
  * 設定方法の詳細は[アクションエディタ](/dashcomb-help-center/ide/property-region/action-editor.md)にご参考ください。
  * ここでは全て初期の「アクション無し」を選びます。
* 「実行」ボタンをクリックして、「成功しました」の「結果」を確認します。
* 「保存」ボタンを押すと、この画面用のDBクエリの作成ができました。

## 参照項目

* [データベースへの接続](/dashcomb-help-center/ide/others/dtassu/database.md)
* [新しいDBの追加](/dashcomb-help-center/tips-and-tricks/add-a-new-database.md)


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.dashcomb.com/dashcomb-help-center/tips-and-tricks/add-a-database-query.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
