Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7022849
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T23:38:06+00:00 2026-05-27T23:38:06+00:00

I have File-Stream enabled database. I have created table with column that has the

  • 0

I have “File-Stream” enabled database. I have created table with column that has the “file-stream” attribute and manage to record successfully row in the table. So, what I have got is image stored in my “File-Stream” as BLOB.

What is my problem?

I have to get this image and show it in the web browser using classic asp (I am total newbie in this server-language and I am not allowed to use the asp.net). I have searched and read a lot (there are many information about doing that with asp.net and almost nothing showing how to do this with classic asp) and found a article (http://www.simple-talk.com/sql/learn-sql-server/an-introduction-to-sql-server-filestream/) that shows to ways to read the data:

“Accessing FILESTREAM Data using TSQL” and “Accessing FILESTREAM data with Managed API”

The first one I have been able to understand and use. The second one (there is a example with vb.net code) I haven’t been able.

This is the code:

‘Create a connection to the database

Dim ConStr As String

ConStr = "Data Source=JACOBXPS\katmaifs;Initial Catalog=NorthPole" & _

     ";Integrated Security=True"

Dim con As New SqlConnection(ConStr)

con.Open()



'Retrieve the FilePath() of the image file

Dim sqlCommand As New SqlCommand()

sqlCommand.Connection = con

sqlCommand.CommandText = "SELECT ItemImage.PathName() AS PathName " + _

                     "FROM items WHERE ItemNumber = 'MS1001'"

Dim filePath As String = sqlCommand.ExecuteScalar()



'Obtain a Transaction Context

Dim transaction As SqlTransaction = con.BeginTransaction("ItemTran")

sqlCommand.Transaction = transaction

sqlCommand.CommandText = "SELECT GET_FILESTREAM_TRANSACTION_CONTEXT()"

Dim txContext As Byte() = sqlCommand.ExecuteScalar()



' Open and read file using SqlFileStream Class

Dim sqlFileStream As New SqlFileStream(filePath, txContext, FileAccess.Read)

Dim buffer As Byte() = New Byte(sqlFileStream.Length) {}

sqlFileStream.Read(buffer, 0, buffer.Length)



'Bind the image data to an image control

Dim ms As MemoryStream = New MemoryStream(buffer)

Dim bmp As Bitmap = New Bitmap(ms)

ItemImage.Image = bmp



'Cleanup

sqlFileStream.Close()

sqlCommand.Transaction.Commit()

con.Close()

I was not able to transform this in classic asp but in the same article I have read something more frustrating:

When accessing FILESTREAM data using TSQL, SQL Server reads the content of the >FILESTREAM data file and serves it to the client. SQL Server memory is used for reading >the content of the data file. Accessing FILESTREAM data using Win32 Streaming does not >use SQL Server memory. In addition it allows the application to take advantage of the >Streaming capabilities of the NT File System.

So what is my real problem?

Can be the vb.net code transform and used in a classic asp?And if it can, does that mean that when I am using the “file-stream” enable futures and want to display data in the web it will be more slow then using desktop application?

I am pretty confused and will appreciate any answer or link with article to read.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T23:38:07+00:00Added an answer on May 27, 2026 at 11:38 pm

    A little confused on the question but if all you’re trying to do is display some BLOB data from the database as an Image on the webpage then you should have an “image.asp” page that looks something like this …

    SQL = "SELECT FILE_NAME,IMAGE_FILE FROM tblImages WHERE ID = " & request("id")
    Set rs =db.Execute( SQL )
    if not(rs.eof) then
    
        Response.ContentType = "application/octet-stream"
        Response.AddHeader "Content-Disposition", "attachment;filename=" & rs("FILE_NAME")
        Response.BinaryWrite rs("IMAGE_FILE")
    else
        response.Write("No such record found in the database at row " & request("id"))
    end if
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have response stream from a ftp web request that returns binary file. I
I have an a FILE STREAM that I want to pass to an EXE
I am using this example to display images, stored in my File-Stream Enabled database
I have a file stream open and ready. How do I access and change
So a FILE stream can have both input and output buffers. You can adjust
I have a incoming stream of bytes (unsigned char) from either a file or
We have a new filestream database that will be initially loaded with 65GB data,
I've configured a db w/ a FileStream group and have a table w/ File
I have this code that saves a pdf file. FileStream fs = new FileStream(SaveLocation,
We have an MTOM-enabled web service that is published with Grails and the Metro

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.