How to fetch data from MSSQL

Could you be a little more specific?
• Is your database connection good?
• Is your query failing for some reason?
• Is there an exception report that you need help interpreting?

i write this query to fetch data " SELECT Photo from ImageTable where id= :id ; "

Fixed that for you.

@Sachin_Jagtap How are you trying to use this query? While the syntax suggests a named query, you have not provided any context.

More information usually yields better answers.

i bind the query to image component by passing parameter

It's not working? What errors do you have? On the gateway web page, is the database connection faulted?

Edit: Another troubleshooting check:
Is the database specified in the binding? [It's a dropdown at the bottom of the binding editor]

data is fetched but in the binary form

Sachin, you are making it very difficult to help you. Your first post is empty. You did not say that you are trying to retrieve image files. In now seems that you are connected to the database but you are getting images back in binary form and you are expecting something else.

Please write a post that explains

  1. Your setup.
  2. What you want.
  3. How you are trying to do it.
  4. What result and problem you have at the moment.

f it's what I think it is, it makes sense. I've seen this in the forum before. Give me a sec, I'll see if I can find it.

Edit: I found the post I was looking for, and it's not related to this.

If I'm reading this correctly, he's querying a blob of an image, and he needs help converting the bytes back into an image file to display it somehow.

I am trying to fetch data from MSSQL database ,connection is valid
i write named query to fetch data which gives me output also but when i bind this query to image component image is not visible

it require datatype conversion ?

Look at these posts about converting a blob to an image in Perspective:
https://forum.inductiveautomation.com/search?q=Blob%20image%20tags%3Aperspective

1 Like

And this one.

1 Like

Thank You So Much Now It's Working.

1 Like