streaming images

G

Guest

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
 
G

Guest

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 said:
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.SqlBinary image = reader.GetSqlBinary(0);

if (!image.IsNull && image.Value.Length > 0)

{

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

this.Response.BinaryWrite (image.Value);

}

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

msuk said:
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
 
G

Guest

Hi,

I am getting a cast error see below

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

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

Response.ContentType = "image/jpeg"

Me.Response.BinaryWrite(image.Value)

Can you please help?

Thanks
Eliyahu Goldin said:
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 said:
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 said:
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.SqlBinary image = reader.GetSqlBinary(0);

if (!image.IsNull && image.Value.Length > 0)

{

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

this.Response.BinaryWrite (image.Value);

}

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

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
 
G

Guest

image = myRow("image") ---> fails here

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

--
-Demetri


msuk said:
Hi,

I am getting a cast error see below

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

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

Response.ContentType = "image/jpeg"

Me.Response.BinaryWrite(image.Value)

Can you please help?

Thanks
Eliyahu Goldin said:
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 said:
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

:

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.SqlBinary image = reader.GetSqlBinary(0);

if (!image.IsNull && image.Value.Length > 0)

{

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

this.Response.BinaryWrite (image.Value);

}

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

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
 
E

Eliyahu Goldin

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.SqlBinary image = reader.GetSqlBinary(0);

if (!image.IsNull && image.Value.Length > 0)

{

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

this.Response.BinaryWrite (image.Value);

}
 
R

Ray Booysen

Are you sure there is a column in the row called "image"?
Hi,

I am getting a cast error see below

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

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

Response.ContentType = "image/jpeg"

Me.Response.BinaryWrite(image.Value)

Can you please help?

Thanks
Eliyahu Goldin said:
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 said:
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

:

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.SqlBinary image = reader.GetSqlBinary(0);

if (!image.IsNull && image.Value.Length > 0)

{

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

this.Response.BinaryWrite (image.Value);

}

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

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
 
E

Eliyahu Goldin

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 said:
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 said:
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.SqlBinary image = reader.GetSqlBinary(0);

if (!image.IsNull && image.Value.Length > 0)

{

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

this.Response.BinaryWrite (image.Value);

}

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

msuk said:
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
 
G

Guest

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.InvalidCastException: Specified cast is not valid.

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

Any ideas

Thanks
Msuk

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

I am getting a cast error see below

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

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

Response.ContentType = "image/jpeg"

Me.Response.BinaryWrite(image.Value)

Can you please help?

Thanks
Eliyahu Goldin said:
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]

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

:

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.SqlBinary image = reader.GetSqlBinary(0);

if (!image.IsNull && image.Value.Length > 0)

{

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

this.Response.BinaryWrite (image.Value);

}

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

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
 
G

Guest

Hi,

I tried the following and still got the same error:

DirectCast(myRow("image"), SqlTypes.SqlBinary)

Thanks
Msuk

msuk said:
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.InvalidCastException: Specified cast is not valid.

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

Any ideas

Thanks
Msuk

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

I am getting a cast error see below

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

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

Response.ContentType = "image/jpeg"

Me.Response.BinaryWrite(image.Value)

Can you please help?

Thanks
:

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]

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

:

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.SqlBinary image = reader.GetSqlBinary(0);

if (!image.IsNull && image.Value.Length > 0)

{

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

this.Response.BinaryWrite (image.Value);

}

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

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
 
E

Eliyahu Goldin

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

msuk said:
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.InvalidCastException: Specified cast is not
valid.

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

Any ideas

Thanks
Msuk

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

I am getting a cast error see below

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

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

Response.ContentType = "image/jpeg"

Me.Response.BinaryWrite(image.Value)

Can you please help?

Thanks
:

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]

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

:

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.SqlBinary image = reader.GetSqlBinary(0);

if (!image.IsNull && image.Value.Length > 0)

{

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

this.Response.BinaryWrite (image.Value);

}

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

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
 
W

Winista

You can find an example here.

http://www.netomatix.com/development/GridViewDisplayBlob.aspx

msuk said:
Hi,

I tried the following and still got the same error:

DirectCast(myRow("image"), SqlTypes.SqlBinary)

Thanks
Msuk

msuk said:
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.InvalidCastException: Specified cast is not
valid.

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

Any ideas

Thanks
Msuk

Ray Booysen said:
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.Tables("Art")
Dim myRow As DataRow = myArt.Rows(0)

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

Response.ContentType = "image/jpeg"

Me.Response.BinaryWrite(image.Value)

Can you please help?

Thanks
:

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]

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

:

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.SqlBinary image = reader.GetSqlBinary(0);

if (!image.IsNull && image.Value.Length > 0)

{

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

this.Response.BinaryWrite (image.Value);

}

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

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top