473,699 Members | 2,680 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

streaming images

All,

I have a ADO.NET dataset that contains a jpeg (blob data) and some fields
that describe the jpeg. I would like to stream the blob data straight to my
ASP.NET 1.1 webform without first saving to disk and display the fields as
labels on the same page is this possible?

Thanks
Msuk
Jul 13 '06 #1
12 1360
Provided you have a data reader open on the record and the image field is
the first in the record, all you need is just:

System.Data.Sql Types.SqlBinary image = reader.GetSqlBi nary(0);

if (!image.IsNull && image.Value.Len gth 0)

{

this.Response.C ontentType = "image/gif";

this.Response.B inaryWrite (image.Value);

}

--
Eliyahu Goldin,
Software Developer & Consultant
Microsoft MVP [ASP.NET]

"msuk" <ms**@discussio ns.microsoft.co mwrote in message
news:87******** *************** ***********@mic rosoft.com...
All,

I have a ADO.NET dataset that contains a jpeg (blob data) and some fields
that describe the jpeg. I would like to stream the blob data straight to
my
ASP.NET 1.1 webform without first saving to disk and display the fields as
labels on the same page is this possible?

Thanks
Msuk

Jul 13 '06 #2
Hi,

I have a remote component that I call that returns me a Dataset whereby the
first field is the image - will this still work using your method?

Thanks
Msuk

"Eliyahu Goldin" wrote:
Provided you have a data reader open on the record and the image field is
the first in the record, all you need is just:

System.Data.Sql Types.SqlBinary image = reader.GetSqlBi nary(0);

if (!image.IsNull && image.Value.Len gth 0)

{

this.Response.C ontentType = "image/gif";

this.Response.B inaryWrite (image.Value);

}

--
Eliyahu Goldin,
Software Developer & Consultant
Microsoft MVP [ASP.NET]

"msuk" <ms**@discussio ns.microsoft.co mwrote in message
news:87******** *************** ***********@mic rosoft.com...
All,

I have a ADO.NET dataset that contains a jpeg (blob data) and some fields
that describe the jpeg. I would like to stream the blob data straight to
my
ASP.NET 1.1 webform without first saving to disk and display the fields as
labels on the same page is this possible?

Thanks
Msuk


Jul 13 '06 #3
The example shows you how to get binary data to the response stream. It is
up to you how to derive the data.
--
Eliyahu Goldin,
Software Developer & Consultant
Microsoft MVP [ASP.NET]

"msuk" <ms**@discussio ns.microsoft.co mwrote in message
news:88******** *************** ***********@mic rosoft.com...
Hi,

I have a remote component that I call that returns me a Dataset whereby
the
first field is the image - will this still work using your method?

Thanks
Msuk

"Eliyahu Goldin" wrote:
>Provided you have a data reader open on the record and the image field is
the first in the record, all you need is just:

System.Data.Sq lTypes.SqlBinar y image = reader.GetSqlBi nary(0);

if (!image.IsNull && image.Value.Len gth 0)

{

this.Response. ContentType = "image/gif";

this.Response. BinaryWrite (image.Value);

}

--
Eliyahu Goldin,
Software Developer & Consultant
Microsoft MVP [ASP.NET]

"msuk" <ms**@discussio ns.microsoft.co mwrote in message
news:87******* *************** ************@mi crosoft.com...
All,

I have a ADO.NET dataset that contains a jpeg (blob data) and some
fields
that describe the jpeg. I would like to stream the blob data straight
to
my
ASP.NET 1.1 webform without first saving to disk and display the fields
as
labels on the same page is this possible?

Thanks
Msuk



Jul 13 '06 #4
Hi,

I am getting a cast error see below

Dim myArt As DataTable
myArt = dsArtWork.Table s("Art")
Dim myRow As DataRow = myArt.Rows(0)

Dim image As SqlBinary
image = myRow("image") ---fails here

Response.Conten tType = "image/jpeg"

Me.Response.Bin aryWrite(image. Value)

Can you please help?

Thanks
"Eliyahu Goldin" wrote:
The example shows you how to get binary data to the response stream. It is
up to you how to derive the data.
--
Eliyahu Goldin,
Software Developer & Consultant
Microsoft MVP [ASP.NET]

"msuk" <ms**@discussio ns.microsoft.co mwrote in message
news:88******** *************** ***********@mic rosoft.com...
Hi,

I have a remote component that I call that returns me a Dataset whereby
the
first field is the image - will this still work using your method?

Thanks
Msuk

"Eliyahu Goldin" wrote:
Provided you have a data reader open on the record and the image field is
the first in the record, all you need is just:

System.Data.Sql Types.SqlBinary image = reader.GetSqlBi nary(0);

if (!image.IsNull && image.Value.Len gth 0)

{

this.Response.C ontentType = "image/gif";

this.Response.B inaryWrite (image.Value);

}

--
Eliyahu Goldin,
Software Developer & Consultant
Microsoft MVP [ASP.NET]

"msuk" <ms**@discussio ns.microsoft.co mwrote in message
news:87******** *************** ***********@mic rosoft.com...
All,

I have a ADO.NET dataset that contains a jpeg (blob data) and some
fields
that describe the jpeg. I would like to stream the blob data straight
to
my
ASP.NET 1.1 webform without first saving to disk and display the fields
as
labels on the same page is this possible?

Thanks
Msuk


Jul 13 '06 #5
image = myRow("image") ---fails here

Why does it fail there? What is the error message?

--
-Demetri
"msuk" wrote:
Hi,

I am getting a cast error see below

Dim myArt As DataTable
myArt = dsArtWork.Table s("Art")
Dim myRow As DataRow = myArt.Rows(0)

Dim image As SqlBinary
image = myRow("image") ---fails here

Response.Conten tType = "image/jpeg"

Me.Response.Bin aryWrite(image. Value)

Can you please help?

Thanks
"Eliyahu Goldin" wrote:
The example shows you how to get binary data to the response stream. It is
up to you how to derive the data.
--
Eliyahu Goldin,
Software Developer & Consultant
Microsoft MVP [ASP.NET]

"msuk" <ms**@discussio ns.microsoft.co mwrote in message
news:88******** *************** ***********@mic rosoft.com...
Hi,
>
I have a remote component that I call that returns me a Dataset whereby
the
first field is the image - will this still work using your method?
>
Thanks
Msuk
>
"Eliyahu Goldin" wrote:
>
>Provided you have a data reader open on the record and the image field is
>the first in the record, all you need is just:
>>
>System.Data.Sq lTypes.SqlBinar y image = reader.GetSqlBi nary(0);
>>
>if (!image.IsNull && image.Value.Len gth 0)
>>
>{
>>
>this.Response. ContentType = "image/gif";
>>
>this.Response. BinaryWrite (image.Value);
>>
>}
>>
>--
>Eliyahu Goldin,
>Software Developer & Consultant
>Microsoft MVP [ASP.NET]
>>
>"msuk" <ms**@discussio ns.microsoft.co mwrote in message
>news:87******* *************** ************@mi crosoft.com...
All,
>
I have a ADO.NET dataset that contains a jpeg (blob data) and some
fields
that describe the jpeg. I would like to stream the blob data straight
to
my
ASP.NET 1.1 webform without first saving to disk and display the fields
as
labels on the same page is this possible?
>
Thanks
Msuk
>>
>>
>>
Jul 13 '06 #6
Are you sure there is a column in the row called "image"?

msuk wrote:
Hi,

I am getting a cast error see below

Dim myArt As DataTable
myArt = dsArtWork.Table s("Art")
Dim myRow As DataRow = myArt.Rows(0)

Dim image As SqlBinary
image = myRow("image") ---fails here

Response.Conten tType = "image/jpeg"

Me.Response.Bin aryWrite(image. Value)

Can you please help?

Thanks
"Eliyahu Goldin" wrote:
>The example shows you how to get binary data to the response stream. It is
up to you how to derive the data.
--
Eliyahu Goldin,
Software Developer & Consultant
Microsoft MVP [ASP.NET]

"msuk" <ms**@discussio ns.microsoft.co mwrote in message
news:88******* *************** ************@mi crosoft.com...
>>Hi,

I have a remote component that I call that returns me a Dataset whereby
the
first field is the image - will this still work using your method?

Thanks
Msuk

"Eliyahu Goldin" wrote:

Provided you have a data reader open on the record and the image field is
the first in the record, all you need is just:

System.Data. SqlTypes.SqlBin ary image = reader.GetSqlBi nary(0);

if (!image.IsNull && image.Value.Len gth 0)

{

this.Respons e.ContentType = "image/gif";

this.Respons e.BinaryWrite (image.Value);

}

--
Eliyahu Goldin,
Software Developer & Consultant
Microsoft MVP [ASP.NET]

"msuk" <ms**@discussio ns.microsoft.co mwrote in message
news:87***** *************** **************@ microsoft.com.. .
All,
>
I have a ADO.NET dataset that contains a jpeg (blob data) and some
fields
that describe the jpeg. I would like to stream the blob data straight
to
my
ASP.NET 1.1 webform without first saving to disk and display the fields
as
labels on the same page is this possible?
>
Thanks
Msuk


Jul 13 '06 #7
All,

This is the error I am getting

Server Error in '/' Application.
--------------------------------------------------------------------------------

Specified cast is not valid.
Description: An unhandled exception occurred during the execution of the
current web request. Please review the stack trace for more information about
the error and where it originated in the code.

Exception Details: System.InvalidC astException: Specified cast is not valid.

I have checked myRow("image") and it contains an array of bytes.

Any ideas

Thanks
Msuk

"Ray Booysen" wrote:
Are you sure there is a column in the row called "image"?

msuk wrote:
Hi,

I am getting a cast error see below

Dim myArt As DataTable
myArt = dsArtWork.Table s("Art")
Dim myRow As DataRow = myArt.Rows(0)

Dim image As SqlBinary
image = myRow("image") ---fails here

Response.Conten tType = "image/jpeg"

Me.Response.Bin aryWrite(image. Value)

Can you please help?

Thanks
"Eliyahu Goldin" wrote:
The example shows you how to get binary data to the response stream. It is
up to you how to derive the data.
--
Eliyahu Goldin,
Software Developer & Consultant
Microsoft MVP [ASP.NET]

"msuk" <ms**@discussio ns.microsoft.co mwrote in message
news:88******** *************** ***********@mic rosoft.com...
Hi,

I have a remote component that I call that returns me a Dataset whereby
the
first field is the image - will this still work using your method?

Thanks
Msuk

"Eliyahu Goldin" wrote:

Provided you have a data reader open on the record and the image field is
the first in the record, all you need is just:

System.Data.S qlTypes.SqlBina ry image = reader.GetSqlBi nary(0);

if (!image.IsNull && image.Value.Len gth 0)

{

this.Response .ContentType = "image/gif";

this.Response .BinaryWrite (image.Value);

}

--
Eliyahu Goldin,
Software Developer & Consultant
Microsoft MVP [ASP.NET]

"msuk" <ms**@discussio ns.microsoft.co mwrote in message
news:87****** *************** *************@m icrosoft.com...
All,

I have a ADO.NET dataset that contains a jpeg (blob data) and some
fields
that describe the jpeg. I would like to stream the blob data straight
to
my
ASP.NET 1.1 webform without first saving to disk and display the fields
as
labels on the same page is this possible?

Thanks
Msuk

Jul 13 '06 #8
You need to typecast myRow("image") to the type you are reading it into.
--
Eliyahu Goldin,
Software Developer & Consultant
Microsoft MVP [ASP.NET]

"msuk" <ms**@discussio ns.microsoft.co mwrote in message
news:B5******** *************** ***********@mic rosoft.com...
All,

This is the error I am getting

Server Error in '/' Application.
--------------------------------------------------------------------------------

Specified cast is not valid.
Description: An unhandled exception occurred during the execution of the
current web request. Please review the stack trace for more information
about
the error and where it originated in the code.

Exception Details: System.InvalidC astException: Specified cast is not
valid.

I have checked myRow("image") and it contains an array of bytes.

Any ideas

Thanks
Msuk

"Ray Booysen" wrote:
>Are you sure there is a column in the row called "image"?

msuk wrote:
Hi,

I am getting a cast error see below

Dim myArt As DataTable
myArt = dsArtWork.Table s("Art")
Dim myRow As DataRow = myArt.Rows(0)

Dim image As SqlBinary
image = myRow("image") ---fails here

Response.Conten tType = "image/jpeg"

Me.Response.Bin aryWrite(image. Value)

Can you please help?

Thanks
"Eliyahu Goldin" wrote:

The example shows you how to get binary data to the response stream.
It is
up to you how to derive the data.
--
Eliyahu Goldin,
Software Developer & Consultant
Microsoft MVP [ASP.NET]

"msuk" <ms**@discussio ns.microsoft.co mwrote in message
news:88******* *************** ************@mi crosoft.com...
Hi,

I have a remote component that I call that returns me a Dataset
whereby
the
first field is the image - will this still work using your method?

Thanks
Msuk

"Eliyahu Goldin" wrote:

Provided you have a data reader open on the record and the image
field is
the first in the record, all you need is just:

System.Data. SqlTypes.SqlBin ary image = reader.GetSqlBi nary(0);

if (!image.IsNull && image.Value.Len gth 0)

{

this.Respons e.ContentType = "image/gif";

this.Respons e.BinaryWrite (image.Value);

}

--
Eliyahu Goldin,
Software Developer & Consultant
Microsoft MVP [ASP.NET]

"msuk" <ms**@discussio ns.microsoft.co mwrote in message
news:87***** *************** **************@ microsoft.com.. .
All,
>
I have a ADO.NET dataset that contains a jpeg (blob data) and some
fields
that describe the jpeg. I would like to stream the blob data
straight
to
my
ASP.NET 1.1 webform without first saving to disk and display the
fields
as
labels on the same page is this possible?
>
Thanks
Msuk


Jul 13 '06 #9
Hi,

I tried the following and still got the same error:

DirectCast(myRo w("image"), SqlTypes.SqlBin ary)

Thanks
Msuk

"msuk" wrote:
All,

This is the error I am getting

Server Error in '/' Application.
--------------------------------------------------------------------------------

Specified cast is not valid.
Description: An unhandled exception occurred during the execution of the
current web request. Please review the stack trace for more information about
the error and where it originated in the code.

Exception Details: System.InvalidC astException: Specified cast is not valid.

I have checked myRow("image") and it contains an array of bytes.

Any ideas

Thanks
Msuk

"Ray Booysen" wrote:
Are you sure there is a column in the row called "image"?

msuk wrote:
Hi,
>
I am getting a cast error see below
>
Dim myArt As DataTable
myArt = dsArtWork.Table s("Art")
Dim myRow As DataRow = myArt.Rows(0)
>
Dim image As SqlBinary
image = myRow("image") ---fails here
>
Response.Conten tType = "image/jpeg"
>
Me.Response.Bin aryWrite(image. Value)
>
Can you please help?
>
Thanks
"Eliyahu Goldin" wrote:
>
>The example shows you how to get binary data to the response stream. It is
>up to you how to derive the data.
>--
>Eliyahu Goldin,
>Software Developer & Consultant
>Microsoft MVP [ASP.NET]
>>
>"msuk" <ms**@discussio ns.microsoft.co mwrote in message
>news:88******* *************** ************@mi crosoft.com...
>>Hi,
>>>
>>I have a remote component that I call that returns me a Dataset whereby
>>the
>>first field is the image - will this still work using your method?
>>>
>>Thanks
>>Msuk
>>>
>>"Eliyahu Goldin" wrote:
>>>
>>>Provided you have a data reader open on the record and the image field is
>>>the first in the record, all you need is just:
>>>>
>>>System.Data. SqlTypes.SqlBin ary image = reader.GetSqlBi nary(0);
>>>>
>>>if (!image.IsNull && image.Value.Len gth 0)
>>>>
>>>{
>>>>
>>>this.Respons e.ContentType = "image/gif";
>>>>
>>>this.Respons e.BinaryWrite (image.Value);
>>>>
>>>}
>>>>
>>>--
>>>Eliyahu Goldin,
>>>Software Developer & Consultant
>>>Microsoft MVP [ASP.NET]
>>>>
>>>"msuk" <ms**@discussio ns.microsoft.co mwrote in message
>>>news:87***** *************** **************@ microsoft.com.. .
>>>>All,
>>>>>
>>>>I have a ADO.NET dataset that contains a jpeg (blob data) and some
>>>>fields
>>>>that describe the jpeg. I would like to stream the blob data straight
>>>>to
>>>>my
>>>>ASP.NET 1.1 webform without first saving to disk and display the fields
>>>>as
>>>>labels on the same page is this possible?
>>>>>
>>>>Thanks
>>>>Msuk
>>>>
>>>>
>>
>>
Jul 13 '06 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
334
by: Phil | last post by:
Hi I have an issue when trying to stream blob image data from a SQL table to a .aspx page. the code I have works for GIF and JPEG but the images can be multiple pages and we would like them to open in a TIFF format. But since there are invoices with multiple pages, we would like to open as a TIFF format in Windows Picture and Fax Viewer. (or default for TIFF on client). Basically I need to stream this file to the client and then open in...
3
1794
by: Andreas Müller | last post by:
hi, I like to implement a streaming client but I have no idea how to draw the images. I have a buffer that holds a whole jpeg-image (i stream motion-jpeg), how can i draw this buffer directly without storing it on disk? should I use qt oder sth like that? (linux)
1
1443
by: questions | last post by:
I want to send a partition of video file and some data files(text and images) from one terminal to another terminal. After sending, the video should be playable. Therefore, I have to write a program that perform streaming. 1.-RTSP / RTP, which is better? 2.-Shall i choose to use WMV, ASF or AVI file? 3.-Any other methods are welcome. Please help me.
3
2336
by: A.M-SG | last post by:
Hi, I have a ASP.NET aspx file that needs to pass large images from a network storage to client browser. The requirement is that users cannot have access to the network share. The aspx file must be the only method that users receive image files.
2
9751
by: mpaliath | last post by:
Hi guys I am currently involved in a project which requires me to recieve and play streaming video as well as send it. In Visual C++ is there any free library which helps me do this as 'streaming' is not part of the actual project, i am allowed to use external libraries. Also could anyone tell me where I can learn about video streaming in c++ so I can code the streaming part myself too thx
2
5580
by: duzinga | last post by:
How can I stream the video input from a webcam in a ASP.NET webpage. It's done by using the "form.handle" in windows.forms. But ASP.NET does not have that option. Any help would be appreciated.
1
1971
by: victor | last post by:
Hi, Is it possible to do fast data streaming, for example displaying images with a pace of 15 or 30 frames per second, thru a Remoting-TCPIP channel? (Images can be 512x512 or 1Kx1K). Thanks, victor
4
1618
by: panda | last post by:
Hi, Here is a written descripton of my webpage. One frame split down the middle. The left side is the menu and the right displays what is selected from the menu. the user selects from the menu and on the right, clicks on "download image" link. the user is presented with a download dialog box. The user saves the image and when it is completed goes and selects another item from the menu. But this time nothing happens.
0
1378
by: alitheg007 | last post by:
Hi All, I am intrested in doing a project in which I want to stream live video from anyhand held device could be a mobile phone (via USB or Bluetooth) or CCTV camera or video camera to a PC. Well the aim is to write an application which will connect to this device and then when camera is put on it will start streaming the video on PC. Now you might want want to do manythings with it but we will get to that later. I try to keep adding...
1
2849
by: Faisal Shafiq | last post by:
I want to upload a file direct to the Silverlight Streaming Service from a Web Client such as silverlight application. As per our product requirement we want to upload a .WMV file directly from silverlight client to Silverlight streaming service. I tried to user WebClient and HttpWebRequest for that purpose but, unfortunately I can found the way to do so. There are some problems with both classes. 1. There is no property of get...
0
8615
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9173
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9033
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8911
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8882
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7748
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
4375
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
2
2345
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2009
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.