# Retrieve the data from SQL table to ignition dashboard

**URL:** <https://forum.inductiveautomation.com/t/retrieve-the-data-from-sql-table-to-ignition-dashboard/79003>\
**Category:** Ignition\
**Tags:** vision, scripting, database\
**Created:** [September 12, 2023, 9:52am UTC](https://forum.inductiveautomation.com/t/retrieve-the-data-from-sql-table-to-ignition-dashboard/79003 "2023-09-12T09:52:28Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Riya\_Kaundal](https://avatars.discourse-cdn.com/v4/letter/r/3e96dc/32.png) [@Riya\_Kaundal](https://forum.inductiveautomation.com/u/Riya_Kaundal)\
**Post date:** [September 12, 2023, 9:52am UTC](https://forum.inductiveautomation.com/t/retrieve-the-data-from-sql-table-to-ignition-dashboard/79003/1 "2023-09-12T09:52:28Z")

</div>

I have created a table in SQL and have to retrieve the data from a particular ID column at a time. I've created a numeric textbox named 'sno' in ignition dashboard into which i am putting ID no. and I wish to retrieve the data of that id no. into ignition dashboard, but the error is occurring in my code.

```auto
IDS = event.source.parent.getComponent('sno').value
query = ("SELECT StudentName, FatherName, DOB, Gender, Course, MobileNumber, EmailID, Address, SubmittedBy FROM Std WHERE ID = IDS")

```

error is

```auto

Traceback (most recent call last):
  File "<event:actionPerformed>", line 17, in <module>
java.lang.Exception: java.lang.Exception: Error executing system.db.runQuery(SELECT StudentName, FatherName, DOB, Gender, Course, MobileNumber, EmailID, Address, SubmittedBy FROM Std WHERE ID = IDS, , )

caused by Exception: Error executing system.db.runQuery(SELECT StudentName, FatherName, DOB, Gender, Course, MobileNumber, EmailID, Address, SubmittedBy FROM Std WHERE ID = IDS, , )
caused by GatewayException: Invalid column name 'IDS'.
caused by SQLServerException: Invalid column name 'IDS'.

Ignition v8.1.28 (b2023060110)
Java: Azul Systems, Inc. 11.0.18

```

---

<div class="post-metadata">

**Author:** ![Surya\_Chandra\_Mohan](https://avatars.discourse-cdn.com/v4/letter/s/a9adbd/32.png) [@Surya\_Chandra\_Mohan](https://forum.inductiveautomation.com/u/Surya_Chandra_Mohan)\
**Post date:** [September 12, 2023, 9:56am UTC](https://forum.inductiveautomation.com/t/retrieve-the-data-from-sql-table-to-ignition-dashboard/79003/2 "2023-09-12T09:56:46Z")

</div>

There is an error with system.db.runQuery so try using system.db.runPrepQuery

---

<div class="post-metadata">

**Author:** ![pascal.fragnoud](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pascal.fragnoud/32/24728_2.png) [@pascal.fragnoud](https://forum.inductiveautomation.com/u/pascal.fragnoud)\
**Post date:** [September 12, 2023, 10:04am UTC](https://forum.inductiveautomation.com/t/retrieve-the-data-from-sql-table-to-ignition-dashboard/79003/3 "2023-09-12T10:04:14Z")

</div>

The error message is telling you exactly what's wrong:

> [@Riya\_Kaundal](#):
>
> `Invalid column name 'IDS'`

---

<div class="post-metadata">

**Author:** ![justinedwards.jle](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/justinedwards.jle/32/37854_2.png) [@justinedwards.jle](https://forum.inductiveautomation.com/u/justinedwards.jle)\
**Post date:** [September 12, 2023, 10:29am UTC](https://forum.inductiveautomation.com/t/retrieve-the-data-from-sql-table-to-ignition-dashboard/79003/4 "2023-09-12T10:29:21Z")

</div>

This needs to be done differently. Search the forum for named query examples, and learn how to pass user inputs as parameters. Appending user inputs to your query strings creates an injection attack vulnerability.
