Showing posts with label images. Show all posts
Showing posts with label images. Show all posts

Wednesday, March 21, 2012

Retrieving scanned images

Hi all
I have a scenario where I need to retrieve scanned images for a report. The
plan is to have one page showing items submitted from a table and the
remaining pages producing the linked scanned images. the scanned images will
probably be PDF or data held in XML format. I am thinking the jmp to URL
function or something similar will be used here
thank you
Mickeyyou can use the Image item from the toolbox, drag it onto the report and
follow the wizard.
"Mickey N" <MickeyN@.discussions.microsoft.com> wrote in message
news:46EB0E8F-C0D7-498F-82FB-F3AF9C36270E@.microsoft.com...
> Hi all
> I have a scenario where I need to retrieve scanned images for a report.
> The
> plan is to have one page showing items submitted from a table and the
> remaining pages producing the linked scanned images. the scanned images
> will
> probably be PDF or data held in XML format. I am thinking the jmp to URL
> function or something similar will be used here
> thank you
> Mickey

Tuesday, March 20, 2012

Retrieving Images from SQL Database

Hello everyone!

I have an SQL Database that originally we had an image filename in the "Image" field, and using ASP, concantenated a loaction with it to retrieve an image on our website. We just converted that field to where we can actually place the actual image in the field. My question is, how can I use ASP to retireve and show the image?

Thanks for your help in advance!

Matt

Use the following link for a good example

http://authors.aspalliance.com/stevesmith/articles/imagequery.asp

Retrieving Images from SQL Database

Hello everyone!

I have an SQL Database that originally we had an image filename in the "Image" field, and using ASP, concantenated a loaction with it to retrieve an image on our website. We just converted that field to where we can actually place the actual image in the field. My question is, how can I use ASP to retireve and show the image?

Thanks for your help in advance!

Matt

Use the following link for a good example

http://authors.aspalliance.com/stevesmith/articles/imagequery.asp

Saturday, February 25, 2012

Retrieve Images from SQL db: Code Problem.

Hi,
I want to get an image from a sql server database and display it with an asp:image control. I use C# in MS Visual Studio .Net 2005 and Sql server 2005.
All I've done is:

// and Page Display_image.aspx.cs
protected void Page_Load(object sender, EventArgs e)
{
try
{

SqlConnection Con = new SqlConnection(
"server=localhost;" +
"database=;" +
"uid=;" +
"password=;");

System.String SqlCmd = "SELECT img_data FROM Image WHERE business_id = 2";

System.Data.SqlClient.SqlCommand SqlCmdObj = new System.Data.SqlClient.SqlCommand(SqlCmd, Con);

Con.Open();

System.Data.SqlClient.SqlDataReader SqlReader = SqlCmdObj.ExecuteReader(CommandBehavior.CloseConnection);

SqlReader.Read();

System.Web.HttpContext.Current.Response.ContentType = "image/jpeg";

// I write this:
System.Web.HttpContext.Current.Response.BinaryWrite((byte[])SqlReader["img_data"]);

// Or this:
//System.Drawing.Image _image = System.Drawing.Image.FromStream(new System.IO.MemoryStream((byte[])SqlReader["img_data"]));

//System.Drawing.Image _newimage = _image.GetThumbnailImage(100, 100, null, new System.IntPtr());

//_newimage.Save(System.Web.HttpContext.Current.Response.OutputStream, System.Drawing.Imaging.ImageFormat.Jpeg);

Con.Close();

}
catch (System.Exception Ex)
{

System.Web.HttpContext.Current.Trace.Write(Ex.Message.ToString());
}
}

Both work the same way. I mean the image is displayed well but when I view code of the web page I see this:

...
GIF89aå o ÷ó å݉97)HS ¢ ?x L£0¬B´ç¬D(áâK? ?ô² –I€8`È® û l1ã?#K?L( ?*\X±‰ Î"«Mè± ??
...

TOO MUCH characters before the html tag. And any code of the master page used for this page does not work as well!

Can anyone help me with this? I've tried for 2 days but I still fail.

Thanks.

This should help:

Dim

drAs SqlDataReader

dr = cmd.ExecuteReader

dr.Read()

Response.Clear()

Response.AddHeader(

"Content-type", dr("MimeType"))

Response.AddHeader(

"Content-Disposition","inline; filename=""" & dr("Filename") &"""")Dim buffer()AsByte = dr("Data")Dim blenAsInteger =CType(dr("Data"),Byte()).Length

Response.OutputStream.Write(buffer, 0, blen)

Response.End()

|||Hello Motley,

I've tried your comment, but it stays the same. The image is displayed, but plenty of charaters in the page source still appears.

I guess it's because of the 'response.outputstream.write()' command, so all the image's byte data has been writen to the page's code.

Can you find any way to replace 'outputstream.write()' or some changes to stop those disgusting characters?

Thank you for your help,
maivangho.

Retrieve Image from SqlServer

hi all

i hav a database with some images...images r stored in binary data form

i want to retrieve that image from database and display it in a details View

im inserting images to database like this

public

void OnUpload(Object sender,EventArgs e)

{

int len = Upload.PostedFile.ContentLength;byte[] pic =newbyte[len];

Upload.PostedFile.InputStream.Read (pic, 0, len);

SqlConnection connection =newSqlConnection ("integrated Security=SSPI;Persist Security Info=False;Initial Catalog=dbAsoftWeb;Data Source=ASP");try

{

connection.Open ();

SqlCommand cmd =newSqlCommand("insert into tblStock " +"(Image, Image_Data,[DESC],PRICE,BAL_QTY,PV) values (@.pic, @.text, @.lblProd, @.lblPrice, @.lblPV, @.lblQty) ", connection);

cmd.Parameters.Add(

"@.pic", pic);

cmd.Parameters.Add(

"@.text", Comment.Text);

cmd.Parameters.Add(

"@.lblProd", txtProdName.Text);

cmd.Parameters.Add(

"@.lblPrice", txtPrice.Text);

cmd.Parameters.Add(

"@.lblPV", txtPV.Text);

cmd.Parameters.Add(

"@.lblQty", txtQty.Text);

cmd.ExecuteNonQuery ();

}

finally

{

connection.Close ();

}

im able to get the image in to form but i want to display it in a detailsview

how cani do it..can any one explain me

thanks in advance

Hari

Hi

Check those articles:

Image_In_DetailsView

Image_in_Details_View_part_2

Hope it helps.