开发者

Getting Database Image to JQuery Dialog

I have a SQL Server 2005 database. This database has a table named "GalleryItem". Each GalleryItem has an ID (an int) and a field called "Thumbnail" (an image). Because this field is an image type, it's stored as binary in the database.

My problem is, my user interface is pure HT开发者_如何学CML with JQuery. The user runs a query and the results are returned as JSON. Because it's JSON, I don't know how to bring the image back from the database. Is there a way to do this with JSON / JQuery that I'm not aware of? Or do I need to write the image to the disk first and then reference it via some url that I come up with?

Thank you!


You're partially correct. Essentially, what you need to do is provide a URL that can take the ID (via querystring) which is then used to query the database and get your image data. You then need to stream this image data back to the browser.

A sample of how this can be done is here: How to show a image in database in the image control of Asp.net?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜